find intersection of boundary points

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.

 Risposta accettata

Image Analyst
Image Analyst il 15 Set 2017

1 voto

Use convhull().

4 Commenti

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.
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.
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.

Accedi per commentare.

Più risposte (0)

Categorie

Community Treasure Hunt

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

Start Hunting!

Translated by