how do i fit a tight square around an object?
4 次查看(过去 30 天)
显示 更早的评论
i'm trying to make a size grader for potatoes, and it was the plan to use a picture like
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/161579/image.jpeg)
th.jpg
the thing i need to do is try to fit a tight square around each one of the potatoes to determine the "square measurment" this can for instance be "55", then the square is 55x55mm. does anyone know how to do that?
0 个评论
回答(1 个)
Image Analyst
2017-3-11
See Steve's blog: http://blogs.mathworks.com/steve/2013/11/19/watershed-transform-question-from-tech-support/
Once you have the potatoes separated, simply use regionprops() to get the area and MajorAxisLength. The bounding box is not a reliable measure of the size because it changes depending on the angle of the potato.
1 个评论
Image Analyst
2017-3-11
Just search for "fruit" or "vegetable" tag - this comes up all the time and there is code out there.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!