我正在尝试像这样从原始图像中分割彩色单元:
蓝色单元格是我要细分和计数的目标。
这是我使用的代码:
global ButtonDown
img=imread('Zoom.png');
hsv=rgb2hsv(img);
s=hsv(:,:,2);
bw = imbinarize(s,graythresh(s));
figure
imshow(bw)
se=strel('disk',5);
bw2=imclose(bw,se);
bw3=bwareaopen(bw2,200);
figure
imshow(bw3);
D=-bwdist(~bw3);
mask=imextendedmin(D,2);
D2=imimposemin(D,mask);
Ld=watershed(D);
Water_splited=bw3;
Water_splited(Ld==0)=0;
%axes(handles.axes1);
show_img=Water_splited;
figure
imshow(show_img)
if ButtonDown == 1
pos = get(handles.axes1, 'CurrentPoint');
row=floor(pos(1,2));
col=floor(pos(1,1));
Diy_splited=show_img;
Diy_splited(row,col)=0;
show_img=Diy_splited;
axes(handles.axes1);
imshow(show_img);
end
我使用分水岭算法对贴壁细胞进行了分割,但是发生了过度分割。
结果是:
那么如何避免这种过度分割的问题呢?