Search code examples
opencvmatrixtransformationransac

Calculate a Homography with only Translation, Rotation and Scale in Opencv


I do have two sets of points and I want to find the best transformation between them. In OpenCV, you have the following function:

Mat H = Calib3d.findHomography(src_points, dest_points);

that returns you a 3x3 Homography matrix, using RANSAC. My problem is now, that I only need translation and rotation (& maybe scale), I don't need affine and perspective.

The thing is, my points are only in 2D.

(1) Is there a function to compute something like a homography but with less degrees of freedom?

(2) If there is none, is it possible to extract a 3x3 matrix that does only translation and rotation from the 3x3 homography matrix?

Thanks in advance for any help!

Isa


Solution

  • OpenCV estimateRigidTransform function is exactly what you need: it returns Translation, Rotation and Scale (use false value for fullAffine flag). And it DOES use RANSAC (see source code to be sure of it).