Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

findHomography's implementation in OpenCV comes with some assumptions behind. In the "standard" case of use, you detect keypoints (x,y coordinates) in two images. According to the comments, you get keypoints as coordinates of stars from another algorithm. Now, in the standard case, you compute a "descriptor" for each keypoint in both images. I don't want to delve too much in the details, but it is a way to almost "uniquely" distinguish a keypoint from another.

When you have computed all the descriptors, you use a matching algorithm to pair a keypoint from the first set of point to a keypoint from the second set. The matching algorithm often just compare all the descriptors and pair the most similar. A good proportion of actual outliers may be matched this way, but for the usual application it is okay. Then, you use findHomography as you did and usually, good results arise.

In OpenCV's implementation of findHomography, the assumption is that all the points in input set 1 are already paired with a plausible match in the input set 2. This is where I see a problem with your use of findHomography; I am not sure that you have some way to pair those plausible matches.

In the literature, algorithms exist to match two sets of (x,y) based on their coordinates. One of them is RANSAC, and it is used in findHomography, even if it is in a form not directly of use for you.

If you ever used Matlab, this library implements RANSAC and could be of use to you: https://github.com/RANSAC/RANSAC-Toolbox