3

I have two consecutive frames from a video feed and I detect the keypoints using the FAST algorithm for both of them. I match the keypoints using the sum of squared difference's method (SSD).
So basically I have matched keypoints between the two frames. Now I want to calculate the affine transformation (scale + rotation + translation ) between the two frames from the set of matched keypoints.
I know how to calculate affine transformation from a pair of two points.
My question is how can we calculate it for more than two or three points? I know I have to use least median square method but I'm new to this field so I don't know how to use it.
Can someone please explain this in detail or provide a useful link that does this in a simple way?

Lakshya Kejriwal
  • 1,340
  • 4
  • 17
  • 27

1 Answers1

3

You could use function findHomography, doc for that purpose.

If all the point matches you are providing are good matches, you can keep the default value for parameter method (i.e. value 0). The least square method will then be used.

However, if you obtained the point matches from SSD keypoint matches, you will likely have some wrong matches among the true matches. Hence, you will obtain better results using a robust method such as RANSAC or Least Medians.

Note that this findHomography function returns a perspective transform (i.e. full 3x3 matrix). If you really want an affine transform (2x3 matrix), you will have to implement the least squares (have a look at this post) or RANSAC (see this post) yourself.

Community
  • 1
  • 1
BConic
  • 8,750
  • 2
  • 29
  • 55
  • Is there a method to include RANSAC in SSD matching? – Lakshya Kejriwal Aug 12 '14 at 11:09
  • You could, but RANSAC needs to estimate a model from the putative matches. Hence you should determine something to be estimated, i.e. homography transform, fundamental matrix, etc. That is why in your case, the most natural way to go would be to estimate the affine transform using RANSAC. – BConic Aug 12 '14 at 11:43