This forum is disabled, please visit https://forum.opencv.org

1 | initial version |

My understanding concerning :

- "Compute the determinant of the homography, and see if it's too close to zero for comfort."
=> compute the determinant of the top left 2x2 homography matrix, and check if it's "too close" to zero for comfort...btw you can also check if it's
*too far*from zero because then the invert matrix would have a determinant too close to zero. A determinant of zero would mean the matrix is not inversible, too close to zero would mean*singular*(like you see the plane object at 90°, which is almost impossible if you use**good*matches).

const double det = H.at<double>(0, 0) * H.at<double>(1, 1) - H.at<double>(1, 0) * H.at<double>(0, 1);

One way to do it would be to specify a positive value, say N, and then:

if((fabs(det)>(double)N) && (fabs(det)<(1.0/(double)N)) return false; // bad homography

And while we are at it...if det<0 the homography is not conserving the orientation (clockwise<->anticlockwise), except if you are watching the object in a mirror...it is certainly not good (plus the sift/surf descriptors are not done to be mirror invariants as far as i know, so you would probably don'thave good maches).

if(det<0) return false; // no mirrors in the scene

/* [Detecting Planar Homographies in an Image Pair Etienne Vincent and Robert Laganiere School of Information Technology and Engineering University of Ottawa Canada K1N 6N5] http://www.site.uottawa.ca/research */

2 | No.2 Revision |

My understanding concerning :

- "Compute the determinant of the homography, and see if it's too close to zero for comfort."
=> compute the determinant of the top left 2x2 homography matrix, and check if it's "too close" to zero for comfort...btw you can also check if it's
*too far*from zero because then the invert matrix would have a determinant too close to zero. A determinant of zero would mean the matrix is not inversible, too close to zero would mean*singular*(like you see the plane object at 90°, which is almost impossible if you use**good*matches).

const double det = H.at<double>(0, 0) * H.at<double>(1, 1) - H.at<double>(1, 0) * H.at<double>(0, 1);

One way to do it would be to specify a positive value, say N, and then:

if((fabs(det)>(double)N) && (fabs(det)<(1.0/(double)N)) return false; // bad homography

And while we are at it...if det<0 the homography is not conserving the orientation (clockwise<->anticlockwise), except if you are watching the object in a mirror...it is certainly not good (plus the sift/surf descriptors are not done to be mirror invariants as far as i know, so you would probably don'thave good maches).

if(det<0) return false; // no mirrors in the scene

/*
[Detecting Planar Homographies in an Image Pair
Etienne Vincent and Robert Laganiere
School of Information Technology and Engineering
University of Ottawa
Canada K1N 6N5]
~~http://www.site.uottawa.ca/research
~~*/

3 | No.3 Revision |

My understanding concerning :

- "Compute the determinant of the homography, and see if it's too close to zero for comfort."
=> compute the determinant of the top left 2x2 homography matrix, and check if it's "too close" to zero for comfort...btw you can also check if it's
*too far*from zero because then the invert matrix would have a determinant too close to zero. A determinant of zero would mean the matrix is not inversible, too close to zero would mean*singular*(like you see the plane object at 90°, which is almost impossible if you use**good*matches).

const double det = H.at<double>(0, 0) * H.at<double>(1, 1) - H.at<double>(1, 0) * H.at<double>(0, 1);

One way to do it would be to specify a positive value, higher than 1, say N, and then:

if((fabs(det)>(double)N) ~~&& ~~|| (fabs(det)<(1.0/(double)N)) return false; // bad homography

And while we are at it...if det<0 the homography is not conserving the orientation (clockwise<->anticlockwise), except if you are watching the object in a mirror...it is certainly not good (plus the sift/surf descriptors are not done to be mirror invariants as far as i know, so you would probably don'thave good maches).

if(det<0) return false; // no mirrors in the scene

~~/*
~~/* for reading & reference :
[Detecting Planar Homographies in an Image Pair
Etienne Vincent and Robert Laganiere
School of Information Technology and Engineering
University of Ottawa
Canada K1N 6N5]
*/

4 | No.4 Revision |

My understanding concerning :

- "Compute the determinant of the homography, and see if it's too close to zero for
~~comfort." => compute~~comfort."

Compute the determinant of the top left 2x2 homography matrix, and check if it's "too close" to zero for comfort...btw you can also check if it's *too *far from zero because then the invert matrix would have a determinant too close to zero. A determinant of zero would mean the matrix is not inversible, too close to zero would mean *too far* *singular (like you see the plane object at 90°, which is almost impossible if you use *singular* *good matches).**good* ~~ ~~

One way to do it would be to specify a positive value, higher than 1, say N, and then:

if((fabs(det)>(double)N) || (fabs(det)<(1.0/(double)N)) return false; // bad homography

if(det<0) return false; // no mirrors in the scene

/* for reading & reference : [Detecting Planar Homographies in an Image Pair Etienne Vincent and Robert Laganiere School of Information Technology and Engineering University of Ottawa Canada K1N 6N5] */

Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.