# How to know the number of bends in polygon of binary image?

2 views (last 30 days)
saravanakumar D on 3 Jan 2014
Edited: Matt J on 3 Jan 2014
I want to detect triangle and hexagon. But i cannot detect triangle and hexagon. i used to technique permeter^2/(4*pi*Area) ratio. The ratio valed changes with dimension of the image. So i want to is there any technique for count the number of bends in polygon?

Matt J on 3 Jan 2014
Edited: Matt J on 3 Jan 2014
One approach might be to pass the known coordinates of the points in the polygon through VERT2LCON to obtain inequalities representing the polygon
A*x<=b
The A(i,:) will be the normals to the sides of the polygon so ideally the number of the A(i,:) will be the number of sides of the polygon.
Due to discretization error in the boundaries, it is possible that the routine might think a side of the polygon actually partitions into many more sides, but the false extra sides should have very similar normals. Assuming you know some lower bound on the angle between the sides of the polygon, it shouldn't be too hard to bin the false sides together.
##### 2 CommentsShowHide 1 older comment
Matt J on 3 Jan 2014
A fair point. I'll work on that.
For the matter at hand, though, it isn't necessary to understand how A,b interact with Aeq,beq. The polygons here are solid in R^2 and vert2lcon will only return inequality data A,b data (equality data Aeq,beq will be empty).

Image Analyst on 3 Jan 2014
The ratio does not change substantially with the dimension of the image. I don't know why you say it does. It is a dimensionless quantity. As long as you have a decent number of pixels it will be the same for a 1 megapixel image, or a 20 megapixel image. Sure it may be different if your triangle or hexagon is only 5 or 10 pixels big, because the shape is so quantized with such a small shape, but as long as you have a good number of pixels, the triangle should give you a higher ratio, like 2 or more. The more circular it gets (like a hexagon is more circular than a triangle), the close to 1 it becomes.
In your earlier post I think I gave you an answer to look in the FAQ for code to find "kinks" in the boundary. You can still use that if you want.