Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Corresponding points in two matched contours

Hello,

First of all, I just starting using OpenCV, so I'm sorry is the answer is obvious, I tried searching for a solution as well as studying the API, but I'm not making any progress.

I'm working on writing an application that needs to check if certain measurements of an item in a photo are correct. To be concise, having two contours that match reasonably well and having a point p on the first contour, I need the corresponding point on the other contour.

I was thinking that one way of trying this is this:

  1. Transform the second contour (by resizing and rotating it) so it best overlaps with the first one.
  2. Given the point p in the first contour, use pointPolygonTest to compute the distance between p and the second contour.

However I'm stuck because the matchShape function only gives me information regarding the match quality and not how to overlap the contours. So the question is: how do I transform a contour so it best overlaps with another contour?

Thanks, R.