mirror of
https://github.com/opencv/opencv.git
synced 2025-06-08 01:53:19 +08:00
fix #2643: use SVD to solve least squares in cvStereoRectifyUncalibrated
This commit is contained in:
parent
02c7e221a3
commit
20838b6f6e
@ -2778,17 +2778,13 @@ CV_IMPL int cvStereoRectifyUncalibrated(
|
|||||||
cvPerspectiveTransform( _m1, _m1, &H0 );
|
cvPerspectiveTransform( _m1, _m1, &H0 );
|
||||||
cvPerspectiveTransform( _m2, _m2, &H2 );
|
cvPerspectiveTransform( _m2, _m2, &H2 );
|
||||||
CvMat A = cvMat( 1, npoints, CV_64FC3, lines1 ), BxBy, B;
|
CvMat A = cvMat( 1, npoints, CV_64FC3, lines1 ), BxBy, B;
|
||||||
double a[9], atb[3], x[3];
|
double x[3];
|
||||||
CvMat AtA = cvMat( 3, 3, CV_64F, a );
|
|
||||||
CvMat AtB = cvMat( 3, 1, CV_64F, atb );
|
|
||||||
CvMat X = cvMat( 3, 1, CV_64F, x );
|
CvMat X = cvMat( 3, 1, CV_64F, x );
|
||||||
cvConvertPointsHomogeneous( _m1, &A );
|
cvConvertPointsHomogeneous( _m1, &A );
|
||||||
cvReshape( &A, &A, 1, npoints );
|
cvReshape( &A, &A, 1, npoints );
|
||||||
cvReshape( _m2, &BxBy, 1, npoints );
|
cvReshape( _m2, &BxBy, 1, npoints );
|
||||||
cvGetCol( &BxBy, &B, 0 );
|
cvGetCol( &BxBy, &B, 0 );
|
||||||
cvGEMM( &A, &A, 1, 0, 0, &AtA, CV_GEMM_A_T );
|
cvSolve( &A, &B, &X, CV_SVD );
|
||||||
cvGEMM( &A, &B, 1, 0, 0, &AtB, CV_GEMM_A_T );
|
|
||||||
cvSolve( &AtA, &AtB, &X, CV_SVD_SYM );
|
|
||||||
|
|
||||||
double ha[] =
|
double ha[] =
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user