Count overlapping Objects Matlab image

25 vues (au cours des 30 derniers jours)
Lennart Strunk
Lennart Strunk le 9 Déc 2020
I would like to count as many leaves as possible in this image. I was thinking about using edge detection and count either the peaks of the leaves or the main vein of the leaf. I was trying to use hough but it did not work.

Réponses (3)

Mahesh Taparia
Mahesh Taparia le 16 Déc 2020
Hi
You can try with area based approach which can give an approximate count of leaves. First segment the leaves from background and count the number of foreground pixels using regionprops function. Approximate the number of pixels in single leaf by taking few leaves samples and counting. Finally divide the total pixel count with 1 leaf count. It will give a rough estimate. However,if you have more data then you can try deep learning based approach. Hope it will help!
  1 commentaire
Image Analyst
Image Analyst le 16 Déc 2020
Modifié(e) : Image Analyst le 16 Déc 2020
I agree. Since your leaves are very overlapped, there's almost no possibility of separating them. You can see that your edge detection method was a total disaster. The best approach would be to get total area and divide by the average leaf area or a deep learning approach, both of which Mahesh suggested. Now if your leaves were all well separated, it would be a much, much easier problem
Actually you may not even have to count the leaves, even though you might think that at first. If you just want to monitor plant growth, computing the total area may be a good metric to go with. It probably correlates pretty well with the number of leaves and it's much, much easier to compute.

Connectez-vous pour commenter.


Lennart Strunk
Lennart Strunk le 18 Déc 2020
Thanks for your answers! i already seperated a few leaves and got the approximate number of pixels of 1 leaf and divided it with the total number of pixels.
I already told the Biologists that they have to take better pictures next time. My task is to try different methods to count the leaves and compare those methods. The one above is my first one and my teacher really wants me to try and find those veins or peaks. Do you have any ideas? I would really appreciate it.
By the way this is my code to seperate the leaves from the background maybe u have any idea how to make it better since sometimes leaves are also red.
function [filterimage]=beleaf_filtergreen(I)
resizefactor=1;
I_small = imresize(I,resizefactor);
I_small=rgb2hsv(I_small);
H=double(I_small(:,:,1));
S=double(I_small(:,:,2));
V=double(I_small(:,:,3));
[height,width]=size(H);
for i=1:height
for j=1:width
if S(i,j)<0.4 || H(i,j)<0.13 || H(i,j)>0.513
H(i,j)=0; S(i,j)=0; V(i,j)=0;
end
end
end
I_small(:,:,1)=H;
I_small(:,:,2)=S;
I_small(:,:,3)=V;
I_small=hsv2rgb(I_small);
% figure,imshow(I_small);
filterimage=I_small;
end
  1 commentaire
Image Analyst
Image Analyst le 18 Déc 2020
Even if you hand counted them, you'd have a hard time. I still maintain that you should just go with area fraction rather than leaf count. What do you REALLY need to measure and why do you think area fraction will not give it to you. And don't just say we want to count leaves because we want to count leaves. The question is WHY you think you need to count leaves instead of going with area fraction. Like, if you just want to measure plant growth over time, area fraction is probably just as good as leaf count.

Connectez-vous pour commenter.


Lennart Strunk
Lennart Strunk le 20 Jan 2021
I can count leaves by deviding a an average leaf with the total number of green pixels.
Do u guys have any ideas on another method? It does not have to be efficient. I want to compare those methods and calculate which works best compared to counting the leaves with my eyes.
thanks for ur help

Catégories

En savoir plus sur Agriculture dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by