Matlab - 图像识别 - 检测植物叶片数量

时间:2017-03-12 04:42:54

标签: matlab image-processing

我对matlab比较新,我试图做一些图像处理。

申请:

g1= im1(:,:,2);
bw1= im2bw(g1);
se=strel('disk',5);
e1=imerode(bw1,se);
bw1a=bwareaopen(e1,100);

1 个答案:

答案 0 :(得分:0)

这应该让您基本了解应该做什么,这里有一些可能有用的资源。

http://blogs.mathworks.com/steve/2013/11/19/watershed-transform-question-from-tech-support/ http://blog.pedro.si/2014/04/basic-cell-segmentation-in-matlab.html http://blogs.mathworks.com/steve/2006/06/02/cell-segmentation/

enter image description here

greenChannel = rawImage(:,:,2);
binaryImage = im2bw(greenChannel);
removeNoise = bwareaopen(binaryImage,1000);

% apply distance transform to find watershed markers
distanceImage = -bwdist(~removeNoise);
distanceImage(~binaryImage) = -Inf;
distanceImage = imhmin(distanceImage,0.9);

% apply watershed transform to split binary blobs
watershedImage = watershed(distanceImage);

% label each blob with an index
labelImage = bwlabel(watershedImage);
% obtain data on each blob
propsStruct = regionprops(logical(labelImage));
% add some color to the image
watershedImage = label2rgb(watershedImage);

figure
hold on
imshow(rawImage)

for leafIndex = 1:length(propsStruct)
    if propsStruct(leafIndex).Area > 2000
        plot(propsStruct(leafIndex).Centroid(1) , propsStruct(leafIndex).Centroid(2) , 'ko')
    end
end