segmentation algorithm by region growth
显示 更早的评论
Hi I need to complete the following assignement and im having issues. For a reason I don't understand my code is currently drawing the backgroup instead of the region i clicked on..
here is what i need to do : The goal of this practical work is to develop a semi-automatic segmentation algorithm by region growth of a medical image and to extract anatomical measurements of the segmented region.
I have attached a video of what my code should be doing and the image im working with.
img = imread('images\vertebre.png');
imshow(img);
[x, y] = ginput(1);
x = uint16(x);
y = uint16(y);
imgf = medfilt2(img, [7 7]);
imshow(imgf);
elemd2 = strel('disk', 2, 0);
seg = zeros(510,628,'logical');
seg(y,x)=1 ;
seg_precedent = zeros(510,628,'logical');
dispMat = zeros(size(img));
while (~isequal(seg, seg_precedent))
seg_precedent = seg;
intensite_region = sum(seg(:) == 1);
m_region = mean(intensite_region);
std_region = std(intensite_region);
seg_dilate = imdilate(seg, elemd2);
contour = seg - seg_dilate;
ind = find(contour==1);
delta = 12;
binf = m_region - (std_region + delta);
bsup = m_region + (std_region + delta);
contour = seg_dilate - seg;
inf_seg = binf < imgf;
sup_seg = imgf < bsup;
candidats = inf_seg & sup_seg;
seg = candidats;
dispMat = img;
dispMat(seg) = 0;
RGB = cat(3,uint8(seg)*255+dispMat,dispMat,dispMat);
imshow(RGB, [])
drawnow
end
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Modify Image Colors 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!