How to find the area of the lemon in the picture and the percentage of the black spots in the lemon's area

1 view (last 30 days)

Answers (1)

Image Analyst
Image Analyst on 25 Mar 2014
First of all make a jig to hold the fruit that has a contrasting background. I'm thinking of a black paddle with a hold in it that you can set the fruit into. That way, you won't have the green leaves in the background to confuse with the fruit of interest (FOI), nor will you have fingers obscuring any of the fruit. Then convert the image into hsv color space with rg2hsv. Use the value channel, and maybe some others if necessary, to find the background mask. Use that to zero out the background and on what's left (green, black, brown pixels on the fruit), do a color segmentation in HSV color space like I do in my demo in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. You can get different color classes (green, white, brown, black) depending on how you do the segmentation, and then you can get area fractions.

Categories

Find more on Convert Image Type 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!