I was trying to use the new RHO homography algorithm in conjunction with perspectiveTransform, but it seems that the homography matrix calculated by RHO has a wrong size and consequently it is not compatible with that method.
See code below:
H = findHomography(obj_points, scn_points, RHO, 1.0);
perspectiveTransform(obj_corners, scene_corners, H);
Following assertion fails:
error: (-215) scn + 1 == m.cols in function perspectiveTransform
Any clue? It works perfectly with RANSAC.
I've found the solution:
With RHO, I have to check the homography matrix to ensure it is not empty. Giving 4 or more points to findHomography is not enough to get an homography matrix with this method.
Although giving to it about 50 matches to compute, it only retrieves a non empty matrix 40-50% of the times.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With