how to tell whether a shape has a sharp angle

How to tell whether a shape contains a sharp angle like less than 30 degree. Is there any simple algorithm to check? Thanks in advance.

 Respuesta aceptada

Image Analyst
Image Analyst el 16 de Jun. de 2012

1 voto

Get the boundaries with bwboundaries() and then calculate the angle between discrete sets of points (more than just one pair of points with another pair of points).

5 comentarios

sty2004
sty2004 el 17 de Jun. de 2012
It is still too complicated for me...
Is that I have to pick two nearby lines then calculate the angle between?
Can you further elaborate?
Ryan
Ryan el 17 de Jun. de 2012
If you upload a sample image it will be easier to help you.
Image Analyst
Image Analyst el 17 de Jun. de 2012
Let's say you want to see if there is a corner at perimeter element # 100. So you inspect elements, say, 90 - 100, and 100 - 110. Use polyfit to get the slope of the line and see if the two slopes are sufficiently different to indicate a change in slope. Something like (untested)
coeffs1 = polyfit(90:100, signal(90-100), 1);
slope1 = coeffs1(1);
coeffs2 = polyfit(100:110, signal(100-110), 1);
slope2 = coeffs2(1);
etc.
sty2004
sty2004 el 19 de Jun. de 2012
For a circle there are infinte slopes for its vertical slopes on both sides, there will be big difference in slope, how I should deal with this?
Image Analyst
Image Analyst el 19 de Jun. de 2012
MATLAB deals with "inf" just fine. I think you can do
if slope1 - slope2 > 0.5
or whatever...

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 16 de Jun. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by