Counting the squama of lizards

本小妞迷上赌 提交于 2019-11-29 09:38:56
Cape Code

There is one route you should consider: watershed segmentation. Here is a quick and dirty example with your first image (it assumes you have the IP toolbox):

raw=rgb2gray(imread('lCeL8.jpg'));

Icomp = imcomplement(raw);
I3 = imhmin(Icomp,20);
L = watershed(I3);
%%
imagesc(L);
axis image

Result shown with a colormap:

You can then count the cells as follows:

count = numel(unique(L));

One of the advantages is that it can be directly fed to regionprops and give you all the nice details about the individual 'squama':

r=regionprops(L, 'All');
imshow(raw);

for k=2:numel(r)
    if r(k).Area>100 % I chose 100 to filter out the objects with a small are.
        rectangle('Position',r(k).BoundingBox, 'LineWidth',1, 'EdgeColor','b', 'Curvature', [1 1]); 
    end
end

Which you could use to monitor over/under segmentation:

Note: special thanks to @jucestain for helping with the proper access to the fields in the r structure here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!