OHHH
OHHH

Reputation: 1051

Affine transformation and RANSAC: How to compute the number of inliers?

I have 2 images and I am using SIFT to find the matching features. I chose the best matches by thresholding. After doing this, I am trying to use RANSAC to efficiently determine the affine transformation matrix between the two pictures.

From my understanding of the process (and the billion slides on the internet):

  1. Pick 3 random correspondences (min needed to compute the affine transform).

  2. Estimate A.

  3. Count inliers.

Do this for N trials and choose the A that produces the least inliers.

How do I specifically count the number of inliers?

Unfortunately, all the examples focus on regression (e.g. finding 2 points and fitting a line through them, then counting based on some distance. But in this case, we are talking about 3 correspondences and the "line" is not making sense here.

I read somewhere we could model the noise using a Gaussian, but I would like to know how to proceed.

Upvotes: 2

Views: 4559

Answers (1)

NickJH
NickJH

Reputation: 571

RANSAC is simple. Measure the distance between where a point "should be" in the second image (using the 3-point hypothesis) and where it is. For symmetry between the 2 images, you might want to add the squared errors in both directions. Then just apply a threshold to count inliers.

Once you have found the best hypothesis, then you can refine it by regression. You are trying to minimize squared errors in image coordinates (for inliers only). Doing it symmetrically sounds tricky and nonlinear (another answerer may correct me!), but if the transform is fairly close to a similarity, I guess one can cheat by doing it one way, and also by treating x and y in the second image independently. Then it becomes a pair of linear regressions to find each half of the transform matrix.

Upvotes: 0

Related Questions