Simple registration algorithm for small sets of 2D points
<p>I am trying to find a simple algorithm to find the correspondence between two sets of 2D points (registration). One set contains the template of an object I'd like to find and the second set mostly contains points that belong to the object of interest, but it can be noisy (missing points as well as additional points that do not belong to the object). Both sets contain roughly 40 points in 2D. The second set is a homography of the first set (translation, rotation and perspective transform).</p>

<p>I am interested in finding an algorithm for registration in order to get the point-correspondence. I will be using this information to find the transform between the two sets (all of this in OpenCV).</p>

<p>Can anyone suggest an algorithm, library or small bit of code that could do the job? As I'm dealing with small sets, it does not have to be super optimized. Currently, my approach is a RANSAC-like algorithm:</p>

<ol>
<li>Choose 4 random points from set 1 and from set 2.</li>
<li>Compute transform matrix H (using openCV getPerspective())</li>
<li>Warp 1st set of points using H and test how they aligned to the 2nd set of points</li>
<li>Repeat 1-3 N times and choose best transform according to some metric (e.g. sum of squares).</li>
</ol>

<p>Any ideas? Thanks for your input.</p>