How to Eliminate False Positives detected in Segmentation?

I am developing in MATLAB a code, which is supposed to identify the area on a leaf that contains spots to report the severity of a disease.

During my research, I found out about LeafSnap and got inspired by it. So, I tried to follow the paper to segment the leaf on the image using OpenCV Expectation Maximization, which is trained using S and V form HSV color space; however, it still returns some false positives due to reflection or shadow.

As you can see above, the color space have yellowish (in direct sunlight) or blueish (in shadow).

Please suggest any way by which I can avoid that false positives! Thank you

INPUT IMAGE:

 Accepted Answer

Try the attached demo. It works for the one image you uploaded but may not work well with those fixed thresholds depending on how green and cluttered your "background" is.

9 Comments

Thank you, Image Analyst! It works for that case.
The key to getting it to work in other cases is to standardize your image capture conditions, like removing shadows and background clutter. You can easily make a cyc out of butcher paper for example.
Image Analyst, the problem is that the fixed thresholds not work for some cases, which the leaf color changes due to a disease as the below.
Your image capture conditions are making it difficult for you to segment the leaf. Why don't you improve them like I suggested? It's always so much easier to work on an image that's right to begin with than to try to "fix" a bad image before you can start working with it or to make a super complicated algorithm to handle all possible ways that the image might look like. For example, for this image, you don't have a uniform background because of the shadows caused by bad lighting. First put in a white background, then white balance your camera. Then put in your leaf and make sure the lighting is such that you don't have shadows. Perhaps you can put the leaf between a flat, stiff, white foam core board and a sheet of transparent acrylic. If you do that your segmentation will be SO much easier.
I got you! The problem is that some users are sending me the images that they take during visits in plantations. So, it is hard to have a pattern.
If this is people in the wild, like the general public who are uploading to your web site, then you may have to use deep learning. Otherwise, if they're research partners of yours, instruct them with tips on how to take a good photo.
I will take a look in deep learning and see if it can solve the issue. Thank you!

Sign in to comment.

More Answers (0)

Categories

Find more on Agriculture in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!