任何人都可以建议一个matlab代码来实现随机游走算法,用于图像分割,特别是CT图像。
问问题
1580 次
1 回答
1
我建议看看 Leo Grady 的 Graph Analysis Toolbox 以及相应的 Addon for Image Segmentation using Random Walks,请参见此处。下载 Graph Analysis Toolbox 和 Random Walker 代码,并保存文件如下:
praphAnalysisToolbox/
README.txt
random_walker_example.m
random_walker.bmp
axial_CT_slice.bmp
包括graphAnalysisToolbox
在您的路径中以便能够调用演示,即ranomd_walker_example.m
. 演示应该分割提供的图像。在您的情况下,您可能必须根据应用程序和图像设置不同的种子。
例如,种子可以以类似超像素的方式放置:
% Read image into the variable image ...
img = im2double(image);
[height, width, channels] = size(img);
seeds = [];
seed_labels = [];
label = 1;
i = floor(region_height/2);
while i < height
j = floor(region_width/2);
while j < width
seeds = [seeds, sub2ind([height, width], i, j)];
seed_labels = [seed_labels, label];
label = label + 1;
j = j + region_width;
end;
i = i + region_height;
end;
%Apply the random walker algorithms
[labels, ~] = random_walker(img, seeds, seed_labels, beta);
有关更多详细信息,请参阅中的评论random_walker.m
。
于 2016-04-17T12:38:25.150 回答