how to choose threshold while segmenting leaf from background?

@ImageAnalyst sr I want to know how to choose segmentation threshold. As I m working on plant identification from leaf and in my database there are different images it's quite possible threshold for one image not works for another. Sr how to choose it. Kindly reply sr. Thanks

 Accepted Answer

Yes, that's true. If you have just random arbitrary pictures then it may not be possible to do what you want. For example if you have a photo of a forest with dozens of trees in it, then finding and classifying every type of leaf in the photo will not be possible. It's best if you can get a single leaf on a uniform background. Then you can look at the hue, saturation, and lightness histograms to come up with a scheme that works. Personally I'm a fan of triangle thresholding.

6 Comments

Thanks for considering my query sr.in my data set I have leaves on uniform background only but the background colour varies some have pink and other white background. How to choose threshold for segmenting them at a time. And how to choose which colour space we should choose for segmentation hsi, rgb,hsv.
Thanks sr, kindly reply.
I'd use hsv. Have you seen my HSV color segmentation demo in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
Have you tried using im2bw() on each color channel individually and then ANDing or ORing them together?
Segmenting leaves on a white background is, for some reason, something that trillions of people want to do. Search on the "leaf" tag in this forum and you might find code I've posted before.
Thanx sr, yes sr I have went through your demo files. I m going to try ur suggestions. Thanx for help. Il get back with the results.
Thanx sr for ur kind help. And of rgb image components worked for white background, segmenting those in a loop. Il post image on pink background in that there is uneven illumination. Kindly give me it's solution also wn il post it. Once again thanks sr for kind help.
Do you have a leaf on a pink gradient background that you want to post?
Yes sr I do have.. Once I Complete project with white background than il post it. Thnx sr

Sign in to comment.

More Answers (1)

i need dataset of plant.. that u are using please sent me with segmentation code. it is part of my project.. mail me at waqar.ismail001@gmail.com

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!