how can I fit basic shapes (circles, squares) into a binary image?
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
See attached image. I want to fit the largest possible square or circle into the binary image. kind of like convexhull except on the inside. Is there a way to achieve this? thanks for the help!
0 Commenti
Risposta accettata
Image Analyst
il 12 Lug 2017
Yes. Use bwdist() to get the Euclidean Distance Transform, which is the number of pixels away from the edge. Then take the max of that. That will be the longest stretch you can go from the center of a shape to an edge and will be the distance of a shape from the center to the vertex. So locate the location of the max of the EDT with find(). Then draw a shape with its center at that location, making sure that your vertex touches the edge. Sorry, I don't already have code to do that algorithm.
For outside the shape, you might want this: http://www.mathworks.com/matlabcentral/fileexchange/34767-a-suite-of-minimal-bounding-objects
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!