Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you tell if a homography matrix is acceptable or not?

When using OpenCV's findHomography function to estimate an homography between two sets of points, from different images, you will sometimes get a bad homography due to outliers within your input points, even if you use RANSAC or LMEDS.

// opencv java example: Mat H = Calib3d.findHomography( src_points, dst_points, Calib3d.RANSAC, 10 ); 

How can you tell if the resulting 3x3 homography matrix is acceptable or not?

I have looked for an answer to this here in Stackoverflow and in Google and was unable to find it.

I found this article, but it is a bit cryptic to me:

"The geometric error for homographies"

like image 508
Rui Marques Avatar asked Jun 15 '12 14:06

Rui Marques


People also ask

Why do we need 4 points for homography?

Homography is the relation between two planes and the degree of freedom in case of homography transform is 7; hence you need minimum 4 corresponding points.

How many points does it take to solve a homography?

We have seen that a homography can be used to map one image to the other in the case of pure camera rotation or a planar scene. If such a homography exists between the images, four points are sufficient to specify it precisely.

How do you use homography matrix to points?

To apply homography H to a point p, simply compute p' = Hp, where p and p' are (3-dimensional) homogeneous coordinates. p' is then the transformed point.

Is homography matrix full rank?

Homography relates points in first view to points in the second view and since there are no constraints in either views it is a full rank (=3) matrix. Also, homography is defined upto a scale (c in above equation) i.e. it can be changed by a non zero constant without any affect on projective transformation.


1 Answers

The best way to tell if the homography is acceptable is.

1- Take the points of one image and reproject them using the computed homography.

//for one 3D point, this would be the projection px' = H * px; py' = H * py; pz' = H * pz; 

2- Calculate the euclidean distance between the reprojected points and the real points in the image.

Reprojection error for one point. p is the projected point and q is the real point.

enter image description here

3- Establish a treshold that decides if the reprojection error is acceptable.

For example, an error greater than one pixel wouldn't be acceptable for many tracking applications.

like image 87
Jav_Rock Avatar answered Oct 19 '22 08:10

Jav_Rock