# detect point of interest on boundary of an object

Hi,

I have boundaries of semi-circle or eclipse shaped objects. Example images are  The boundary are not smooth and often slightly jagged (when you zoom in). I am looking to detect a point of interest (location x and y) on these boundaries, where we see a definite change in the shape, such as  There can be two outputs:

1. No point of interest as we cannot find a definite change
2. Point of interest with x and y location

Currently, I am using Python and OpenCV. I cannot think of an effective and efficient way to solve this problem

Any guidance in this regard will be really appreciated

edit retag close merge delete

Sort by » oldest newest most voted

My suggestion, calculate the angle between 3 subsequent points on your contour. If the angles start changing drastically, then you will hit an irregularity inside your contour. By limiting the range of angles you can even find concavities and convexities.

Calculating angle between points can be done as follows:

static int angle( Point a, Point b, Point c )
{
cv::Point2d ab = { b.x - a.x, b.y - a.y };
cv::Point2d cb = { b.x - c.x, b.y - c.y };

float dot = (ab.x * cb.x + ab.y * cb.y); // dot product
float cross = (ab.x * cb.y - ab.y * cb.x); // cross product

float alpha = atan2(cross, dot);

return abs(floor(alpha * 180. / M_PI + 0.5));
}

more A thought would be to use findContours with approximation. If you get several small segments in one place, you've found it.

more

but contour will return u one set of points ... as points are connected. How to infer from that?

Official site

GitHub

Wiki

Documentation