MATLAB: Edges in wheat leaves

#image-segmentation #image-processing #edge-filtering

I am trying to find the edges in these leaves. However due to shadow and other nuances normal edge detectors do not work very well.
I have tried a laplacian filter however it does not give back the results I hoped for. I would like to separate overlapping leaves as well though I do not need it to be 100% foolproof. The following code gives me a good idea of the edges however I still need to refine it more.
img=imread("path_to_image");
h=fspecial("laplacian",[3000000 0],10.0);
B=imfilter(img,h);
C=imsubtract(img,B);
imshow(B);
figure;imshow(C);

Best Answer

With this field of view, you cannot know, because there are plants outside the field of view whose leaves are in the field of view, and conversely there are plants inside the scene whose leaves are outside the scene. Plus there may be plants in the scene that are mostly or totally obscured by leaves and thus not visible at all.
Plus with such a small field of view, your statistics will be very inaccurate. You can't just take that one small field and extrapolate the answer out to a whole farm many acres in size.
If you back up and take a larger scene when the leaves are not so big that they blend into neighboring plants, then you'd have a better chance at counting plants.
I still think the color fraction of green is your best bet. It will correlate very well with the number of plants. First you'd build a calibration table where you manually count the number of plants and then find its green fraction. Do this at several time points if you need to, or want to, take snapshots at different times. Then for a given time, and given green fraction, you just look up the number of plants from your calibration lookup table.
Try a search of VisionBib to get papers on crop analysis.