1

I think my question has to do more with understanding the implementation of the opencv method findHomolography than getting it to work.

Before explaining you should know that I don't have any experience coding in cpp, maybe that could be the reason.

I already implement the method successfully but I would like to understand where do things come from.

I took this example code in python from http://www.pyimagesearch.com/2016/01/11/opencv-panorama-stitching/

    # computing a homography requires at least 4 matches
    if len(matches) > 4:
        # construct the two sets of points
        ptsA = np.float32([kpsA[i] for (_, i) in matches])
        ptsB = np.float32([kpsB[i] for (i, _) in matches])

        # compute the homography between the two sets of points
        (H, status) = cv2.findHomography(ptsA, ptsB, cv2.RANSAC,
            reprojThresh)

        # return the matches along with the homograpy matrix
        # and status of each matched point
        return (matches, H, status)

    # otherwise, no homograpy could be computed
    return None

As you see, you get as return values (H, status), the Homolography Matrix (H) and a status for each matched point.

Now the question, where does status come from?

If you take a look at the cpp code for the findHomography method in https://github.com/opencv/opencv/blob/6991c24a27d521907b4c1a75cf92447579eafe90/modules/calib3d/src/fundam.cpp you can see at line 401 there is only:

 return H;

Could someone explain why it is like this?

Thanks in advance!

Kan
  • 21
  • 4
  • c++ doesn't have multiple return values (although it will probably get structured bindings in the next version of the standard). So this second output is returned in the `_mask` parameter that you pass to that function – PeterT Jan 04 '17 at 13:08
  • finding a homography from point matches is a tricky task, because the simple optimization solutions are sensitive to wrong matches (a few wrong matches will destroy the right homography). To overcome this, more robust solutions will identify outliers and not use them. Typical robust solution is RANSAC. In status you will likely see which matches are used (inlier) and which are ignored (outlier) to compute the homography. – Micka Jan 04 '17 at 20:36

0 Answers0