Ask Your Question
0

detect point of interest on boundary of an object

asked 2017-03-20 16:26:52 -0600

Nabeel gravatar image

Hi,

I have boundaries of semi-circle or eclipse shaped objects. Example images are

image description image description

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

image description image description

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 flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2017-03-20 18:44:55 -0600

Tetragramm gravatar image

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

edit flag offensive delete link more

Comments

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

Nabeel gravatar imageNabeel ( 2017-03-20 19:06:19 -0600 )edit
0

answered 2017-03-22 05:23:26 -0600

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));
}
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-03-20 16:26:52 -0600

Seen: 738 times

Last updated: Mar 22 '17