Main Content

Superpixels3

3-D superpixel oversegmentation of 3-D image

description

例子

[[l,,,,数字] = superpixels3(一个,,,,n计算3-D图像的3-D超像素一个n指定要创建的超级像素的数量。功能返回l,一个3-D标签矩阵,数字,返回的超级像素的实际数量。

[[l,,,,数字] = superpixels3(___,,,,名称,价值computes superpixels of image一个使用名称值对来控制分割的各个方面。

例子

全部收缩

load 3-D MRI data, remove any singleton dimensions, and convert the data into a grayscale intensity image.

加载mri; D = squeeze(D); A = ind2gray(D,map);

Calculate the 3-D superpixels. Form an output image where each pixel is set to the mean color of its corresponding superpixel region.

[l,n] = superpixels3(a,34);

show all xy-planes progressively with superpixel boundaries.

imsize = size(a);

创建一堆RGB图像以显示颜色的边界。

insbundaries = zeros(imsize(1),imsize(2),3,imsize(3),,'uint8');为了平面= 1:imsize(3)bw = boundareMask(l(:,,,:,plane));%创建该平面的RGB表示,并显示边界% in cyan.inspusboundaries(:,:,:,,:'cyan');结尾inmand(inspundaries,5)

setthe color of each pixel in output image to the mean intensity of the superpixel region. Show the mean image next to the original. If you run this code, you can use暗示查看MRI数据的每个切片。

p一世XelIdxList = label2idx(L); meanA = zeros(size(A),'喜欢',d);为了superpixel = 1:n memberpixelidx = pixelidxlist {superpixel};平均值(MemberPixelIdx)=平均值(A(MemberPixElidx));结尾暗示(([[一个me一个n一个],5);

输入参数

全部收缩

卷至段,指定为3-D数字阵列。

数据类型:单身的|双倍的|int8|一世nt16|一世nt32|UINT8|uint16|UINT32

des一世red number of superpixels, specified as a positive integer.

数据类型:单身的|双倍的|int8|一世nt16|一世nt32|INT64|UINT8|uint16|UINT32|Uint64

名称值参数

specify optional pairs of arguments asname1 = value1,...,namen = valuen, 在哪里姓名是参数名称和Value一世sthe corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

在R2021a之前,请使用逗号分隔每个名称和值,并附上姓名用引号。

Example:B = superpixels3(A,100,'NumIterations', 20);

超级像素的形状,指定为数字标量。SLIC算法的紧凑性参数控制超级像素的形状。更高的值使超级像素更常规形状,即正方形。较低的值使超级像素粘附在边界更好,使其形状不规则。您可以在范围内指定任何值[0 INF)but typical values are in the range[[0.01,0.1]

笔记

If you specify the'slic0'method, you typically do not need to adjust the'紧凑'范围。与'slic0'method,Superpixel3适应性地完善'紧凑'p一个rameter automatically, thus eliminating the need to determine a good value.

数据类型:单身的|双倍的|int8|一世nt16|一世nt32|INT64|UINT8|uint16|UINT32|Uint64

用于计算超级像素的算法,指定为以下值之一。有关更多信息,请参阅一个lgorithms

Value

意义

'slic0'

Superpixels3uses the SLIC0 algorithm to refine'紧凑'一个d一个pt一世vely after the first iteration. This is the default.

'slic'

'紧凑'在聚类过程中是恒定的。

数据类型:char|细绳

number of iterations used in the clustering phase of the algorithm, specified as a positive integer. For most problems, it is not necessary to adjust this parameter.

数据类型:单身的|双倍的|int8|一世nt16|一世nt32|INT64|UINT8|uint16|UINT32|Uint64

输出参数

全部收缩

标签矩阵,作为正整数的3-D阵列返回。价值1指示第一个区域,2第二个区域,依此类推,依此类推。

数据类型:双倍的

计算的超级像素的数量,返回为正数。

数据类型:双倍的

一个lgorithms

The algorithm used inSuperpixels3一世s一个modified version of the Simple Linear Iterative Clustering (SLIC) algorithm used by超级像素。在高水平上,它创建集群中心,然后在将像素分配给最近的集群中心和更新群集中心的位置之间进行迭代交替。Superpixels3使用距离度量标准确定每个像素的最接近的群集中心。该距离度量结合了强度距离和空间距离。

The function'sCompactness参数来自d的数学形式一世st一个nce metric. The compactness parameter of the algorithm is a scalar value that controls the shape of the superpixels. The distance between two pixels一世一个ndj, 在哪里m是紧凑的值是:

d 一世nt e n s 一世 t y = (( l 一世 - l j 2 d s p 一个 t 一世 一个 l = (( X 一世 - X j 2 + (( y 一世 - y j 2 + (( z 一世 - z j 2 d = (( d 一世nt e n s 一世 t y m 2 + (( d s p 一个 t 一世 一个 l s 2

Compactness has the same meaning as in the 2-D超级像素function: It determines the relative importance of the intensity distance and the spatial distance in the overall distance metric. A lower value makes the superpixels adhere to boundaries better, making them irregularly shaped. A higher value makes the superpixels more regularly shaped. The allowable range for compactness is((0 Inf),,,,一个s一世nthe 2-D function. The typical range has been found through experimentation to be[[0.01 0.1]。输入图像的动态范围在算法中归一化为0至1。这可以使整个图像的紧凑值的含义一致。

版本历史记录

在R2016b中引入