I have set of boundary points which has been acquired through bwboundaris function( it is almost square). Now how to find 4 vertices of the shape.

 Réponse acceptée

Image Analyst
Image Analyst le 15 Sep 2017

1 vote

Use convhull().

4 commentaires

Anil Patel
Anil Patel le 15 Sep 2017
but how to get vertex coordinates thanks
OK, admit it, you never even looked at the documentation, did you? Well if you do, you'll see this example:
xx = -1:.05:1;
yy = abs(sqrt(xx));
[x,y] = pol2cart(xx,yy);
k = convhull(x,y);
plot(x(k),y(k),'r-',x,y,'b*')
And of course x(k) and y(k) are the vertices. If you want coordinates that are not the convex hull, then see my shape recognition demo.
Anil Patel
Anil Patel le 17 Sep 2017
I have already got vertices from boundaries command but now how to get corner location ? youe demo doesnt work it say something else found as its not regular square.
Image Analyst
Image Analyst le 17 Sep 2017
If you have more than 4 convex hull points, then you'll have to figure out which of those are the corner points. Use my demo where I computed the distance away from the centroid and then found the peaks.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by