How to measure the length of banana in binary

4 views (last 30 days)
Hello everyone..
I have a problem in measuring the length and width of the banana image. First I would like to know the length and width of the banana (in pixels). Then, I would to convert it into centimeters. Actual length of bananas is 13 cm, while the width is 2.8 cm. I would like to compare between actual measurement and computational measurements results (in centimeters).
I already find the method regionprops (majoraxislength and minoraxislength) but I still difficulties in using it.
This is the binary image of banana: http://i.imgur.com/tq1f8Zd.jpg
Thank you

Accepted Answer

Image Analyst
Image Analyst on 8 Jun 2013
First of all you need a spatial calibration, like a picture of a ruler. Let me know if you need a demo of how to do that. Then what I'd do, since it looks like you can assume the banana is more or less aligned with the image rows and columns is to sum the image horizontally to get the vertical profile. Then examine that to see where the tips of the banana are (say the top and bottom 20% of distance) and take the mean of the profile in between the tips. By knowing where the profile starts and stops, and by knowing the mean width, you can multiply by your spatial calibration to convert your numbers from pixels to cm. This is so simple that it looks like a homework question - is it?

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!