![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Vision/HomographyAndFundamentalMatrixDecomposition.h>
This class, given point correspondences from two images, estimates the homography and the fundamental matrix, then, depending on the score, decomposes one of them into rotation and translation. More...
This class, given point correspondences from two images, estimates the homography and the fundamental matrix, then, depending on the score, decomposes one of them into rotation and translation.
Public Member Functions | |
| void | setInputPoints (const std::vector< vec2 > &points1, const std::vector< vec2 > &points2) |
| Set input correspondences. | |
| void | setIntrinsics (const mat3 &K) |
| Set camera intrinsics. | |
| bool | compute () |
| Returns true if computation was successful and the transformation from first to second camera pose (i.e. "cam1ToCam2T") has been estimated. | |
| bool | shouldUseHomography () const |
| Returns true if the score ratio between homography and fundamental matrix estimation is > 0.4. | |
| mat4 | cam1ToCam2T () const |
| Returns transformation from first to second camera pose Valid only if "compute" method returns true, otherwise there are multiple possible solutions (see "possibleCam1ToCam2T") | |
| std::vector< std::pair< mat4, int > > | possibleCam1ToCam2T () const |
| Returns all possible transformations from first to second camera. | |
| void | triangulatedPoints (std::vector< vec3 > &points, std::vector< bool > &isPointTriangulated) const |
| Returns the points and the boolean assigned to each point indicating whether the point was successfully triangulated. | |
| double | scoreRatio () const |
| Returns the ratio between the scores for homography and fundamental matrix: scoreH/(scoreH + scoreF) | |
| double | scoreH () const |
| Returns the score for homography estimation. | |
| double | scoreF () const |
| Returns the score for fundamental matrix estimation. Estimated in a similar way as the homography score. | |
| mat3 | H () const |
| Returns estimated homography. | |
| mat3 | F () const |
| Returns estimated fundamental matrix. | |
|
inline |
Returns all possible transformations from first to second camera.
The first value is the matrix, the second the number of inliers. If the computation was successful (i.e. "compute" returns true), there is only one correct solution (can be obtained through "cam1ToCam2T" method). In this case the transformation returned by "cam1ToCam2T" is included in this vector. This method might be useful only in the case when the computation failed.
|
inline |
Returns the score for homography estimation.
Computed as follows. 1) Homographies H12 and H21 are computed 2) For each pair of correspondences a squared distance between point1 and reprojection of point2 into image1 is computed: SD1 = (p1 - H21*p2)^2 3) This squared distance is then normalized by squared sigma: err = SD/sigma^2 4) If this error is larger than a threshold of 5.991, the point correspondence is counted as an outlier, and the score remains the same; otherwise the score is increased by the difference of this threshold and the error 5) steps 2-4 are repeated for a squared distance between point2 and reprojection of point1 into image2 The higher the score, the better