@@ -1319,7 +1319,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
1319
1319
(npoints->rows != 1 && npoints->cols != 1 ) )
1320
1320
CV_Error ( CV_StsUnsupportedFormat,
1321
1321
" the array of point counters must be 1-dimensional integer vector" );
1322
- if (flags & CV_CALIB_TILTED_MODEL )
1322
+ if (flags & CALIB_TILTED_MODEL )
1323
1323
{
1324
1324
// when the tilted sensor model is used the distortion coefficients matrix must have 14 parameters
1325
1325
if (distCoeffs->cols *distCoeffs->rows != 14 )
@@ -1328,7 +1328,7 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
1328
1328
else
1329
1329
{
1330
1330
// when the thin prism model is used the distortion coefficients matrix must have 12 parameters
1331
- if (flags & CV_CALIB_THIN_PRISM_MODEL )
1331
+ if (flags & CALIB_THIN_PRISM_MODEL )
1332
1332
if (distCoeffs->cols *distCoeffs->rows != 12 )
1333
1333
CV_Error ( CV_StsBadArg, " Thin prism model must have 12 parameters in the distortion matrix" );
1334
1334
}
@@ -1498,24 +1498,28 @@ static double cvCalibrateCamera2Internal( const CvMat* objectPoints,
1498
1498
1499
1499
if (flags & CALIB_FIX_ASPECT_RATIO)
1500
1500
mask[0 ] = 0 ;
1501
- if ( flags & CV_CALIB_FIX_FOCAL_LENGTH )
1501
+ if ( flags & CALIB_FIX_FOCAL_LENGTH )
1502
1502
mask[0 ] = mask[1 ] = 0 ;
1503
- if ( flags & CV_CALIB_FIX_PRINCIPAL_POINT )
1503
+ if ( flags & CALIB_FIX_PRINCIPAL_POINT )
1504
1504
mask[2 ] = mask[3 ] = 0 ;
1505
- if ( flags & CV_CALIB_ZERO_TANGENT_DIST )
1505
+ if ( flags & CALIB_ZERO_TANGENT_DIST )
1506
1506
{
1507
1507
param[6 ] = param[7 ] = 0 ;
1508
1508
mask[6 ] = mask[7 ] = 0 ;
1509
1509
}
1510
1510
if ( !(flags & CALIB_RATIONAL_MODEL) )
1511
1511
flags |= CALIB_FIX_K4 + CALIB_FIX_K5 + CALIB_FIX_K6;
1512
- if ( !(flags & CV_CALIB_THIN_PRISM_MODEL ))
1512
+ if ( !(flags & CALIB_THIN_PRISM_MODEL ))
1513
1513
flags |= CALIB_FIX_S1_S2_S3_S4;
1514
- if ( !(flags & CV_CALIB_TILTED_MODEL ))
1514
+ if ( !(flags & CALIB_TILTED_MODEL ))
1515
1515
flags |= CALIB_FIX_TAUX_TAUY;
1516
1516
1517
1517
mask[ 4 ] = !(flags & CALIB_FIX_K1);
1518
1518
mask[ 5 ] = !(flags & CALIB_FIX_K2);
1519
+ if ( flags & CALIB_FIX_TANGENT_DIST )
1520
+ {
1521
+ mask[6 ] = mask[7 ] = 1 ;
1522
+ }
1519
1523
mask[ 8 ] = !(flags & CALIB_FIX_K3);
1520
1524
mask[ 9 ] = !(flags & CALIB_FIX_K4);
1521
1525
mask[10 ] = !(flags & CALIB_FIX_K5);
@@ -1817,39 +1821,39 @@ double cvStereoCalibrate( const CvMat* _objectPoints, const CvMat* _imagePoints1
1817
1821
cvConvert ( points, imagePoints[k] );
1818
1822
cvReshape ( imagePoints[k], imagePoints[k], 2 , 1 );
1819
1823
1820
- if ( flags & (CV_CALIB_FIX_INTRINSIC|CV_CALIB_USE_INTRINSIC_GUESS |
1821
- CV_CALIB_FIX_ASPECT_RATIO|CV_CALIB_FIX_FOCAL_LENGTH ) )
1824
+ if ( flags & (CALIB_FIX_INTRINSIC|CALIB_USE_INTRINSIC_GUESS |
1825
+ CALIB_FIX_ASPECT_RATIO|CALIB_FIX_FOCAL_LENGTH ) )
1822
1826
cvConvert ( cameraMatrix, &K[k] );
1823
1827
1824
- if ( flags & (CV_CALIB_FIX_INTRINSIC|CV_CALIB_USE_INTRINSIC_GUESS |
1825
- CV_CALIB_FIX_K1|CV_CALIB_FIX_K2|CV_CALIB_FIX_K3|CV_CALIB_FIX_K4|CV_CALIB_FIX_K5|CV_CALIB_FIX_K6 ) )
1828
+ if ( flags & (CALIB_FIX_INTRINSIC|CALIB_USE_INTRINSIC_GUESS |
1829
+ CALIB_FIX_K1|CALIB_FIX_K2|CALIB_FIX_K3|CALIB_FIX_K4|CALIB_FIX_K5|CALIB_FIX_K6 ) )
1826
1830
{
1827
1831
CvMat tdist = cvMat ( distCoeffs->rows , distCoeffs->cols ,
1828
1832
CV_MAKETYPE (CV_64F,CV_MAT_CN (distCoeffs->type )), Dist[k].data .db );
1829
1833
cvConvert ( distCoeffs, &tdist );
1830
1834
}
1831
1835
1832
- if ( !(flags & (CV_CALIB_FIX_INTRINSIC|CV_CALIB_USE_INTRINSIC_GUESS )))
1836
+ if ( !(flags & (CALIB_FIX_INTRINSIC|CALIB_USE_INTRINSIC_GUESS )))
1833
1837
{
1834
1838
cvCalibrateCamera2 ( objectPoints, imagePoints[k],
1835
1839
npoints, imageSize, &K[k], &Dist[k], NULL , NULL , flags );
1836
1840
}
1837
1841
}
1838
1842
1839
- if ( flags & CV_CALIB_SAME_FOCAL_LENGTH )
1843
+ if ( flags & CALIB_SAME_FOCAL_LENGTH )
1840
1844
{
1841
1845
static const int avg_idx[] = { 0 , 4 , 2 , 5 , -1 };
1842
1846
for ( k = 0 ; avg_idx[k] >= 0 ; k++ )
1843
1847
A[0 ][avg_idx[k]] = A[1 ][avg_idx[k]] = (A[0 ][avg_idx[k]] + A[1 ][avg_idx[k]])*0.5 ;
1844
1848
}
1845
1849
1846
- if ( flags & CV_CALIB_FIX_ASPECT_RATIO )
1850
+ if ( flags & CALIB_FIX_ASPECT_RATIO )
1847
1851
{
1848
1852
for ( k = 0 ; k < 2 ; k++ )
1849
1853
aspectRatio[k] = A[k][0 ]/A[k][4 ];
1850
1854
}
1851
1855
1852
- recomputeIntrinsics = (flags & CV_CALIB_FIX_INTRINSIC ) == 0 ;
1856
+ recomputeIntrinsics = (flags & CALIB_FIX_INTRINSIC ) == 0 ;
1853
1857
1854
1858
err.reset (cvCreateMat ( maxPoints*2 , 1 , CV_64F ));
1855
1859
Je.reset (cvCreateMat ( maxPoints*2 , 6 , CV_64F ));
@@ -1873,40 +1877,40 @@ double cvStereoCalibrate( const CvMat* _objectPoints, const CvMat* _imagePoints1
1873
1877
if ( recomputeIntrinsics )
1874
1878
{
1875
1879
uchar* imask = solver.mask ->data .ptr + nparams - NINTRINSIC*2 ;
1876
- if ( !(flags & CV_CALIB_RATIONAL_MODEL ) )
1877
- flags |= CV_CALIB_FIX_K4 | CV_CALIB_FIX_K5 | CV_CALIB_FIX_K6 ;
1878
- if ( !(flags & CV_CALIB_THIN_PRISM_MODEL ) )
1879
- flags |= CV_CALIB_FIX_S1_S2_S3_S4 ;
1880
- if ( !(flags & CV_CALIB_TILTED_MODEL ) )
1881
- flags |= CV_CALIB_FIX_TAUX_TAUY ;
1882
- if ( flags & CV_CALIB_FIX_ASPECT_RATIO )
1880
+ if ( !(flags & CALIB_RATIONAL_MODEL ) )
1881
+ flags |= CALIB_FIX_K4 | CALIB_FIX_K5 | CALIB_FIX_K6 ;
1882
+ if ( !(flags & CALIB_THIN_PRISM_MODEL ) )
1883
+ flags |= CALIB_FIX_S1_S2_S3_S4 ;
1884
+ if ( !(flags & CALIB_TILTED_MODEL ) )
1885
+ flags |= CALIB_FIX_TAUX_TAUY ;
1886
+ if ( flags & CALIB_FIX_ASPECT_RATIO )
1883
1887
imask[0 ] = imask[NINTRINSIC] = 0 ;
1884
- if ( flags & CV_CALIB_FIX_FOCAL_LENGTH )
1888
+ if ( flags & CALIB_FIX_FOCAL_LENGTH )
1885
1889
imask[0 ] = imask[1 ] = imask[NINTRINSIC] = imask[NINTRINSIC+1 ] = 0 ;
1886
- if ( flags & CV_CALIB_FIX_PRINCIPAL_POINT )
1890
+ if ( flags & CALIB_FIX_PRINCIPAL_POINT )
1887
1891
imask[2 ] = imask[3 ] = imask[NINTRINSIC+2 ] = imask[NINTRINSIC+3 ] = 0 ;
1888
- if ( flags & CV_CALIB_ZERO_TANGENT_DIST )
1892
+ if ( flags & CALIB_ZERO_TANGENT_DIST )
1889
1893
imask[6 ] = imask[7 ] = imask[NINTRINSIC+6 ] = imask[NINTRINSIC+7 ] = 0 ;
1890
- if ( flags & CV_CALIB_FIX_K1 )
1894
+ if ( flags & CALIB_FIX_K1 )
1891
1895
imask[4 ] = imask[NINTRINSIC+4 ] = 0 ;
1892
- if ( flags & CV_CALIB_FIX_K2 )
1896
+ if ( flags & CALIB_FIX_K2 )
1893
1897
imask[5 ] = imask[NINTRINSIC+5 ] = 0 ;
1894
- if ( flags & CV_CALIB_FIX_K3 )
1898
+ if ( flags & CALIB_FIX_K3 )
1895
1899
imask[8 ] = imask[NINTRINSIC+8 ] = 0 ;
1896
- if ( flags & CV_CALIB_FIX_K4 )
1900
+ if ( flags & CALIB_FIX_K4 )
1897
1901
imask[9 ] = imask[NINTRINSIC+9 ] = 0 ;
1898
- if ( flags & CV_CALIB_FIX_K5 )
1902
+ if ( flags & CALIB_FIX_K5 )
1899
1903
imask[10 ] = imask[NINTRINSIC+10 ] = 0 ;
1900
- if ( flags & CV_CALIB_FIX_K6 )
1904
+ if ( flags & CALIB_FIX_K6 )
1901
1905
imask[11 ] = imask[NINTRINSIC+11 ] = 0 ;
1902
- if ( flags & CV_CALIB_FIX_S1_S2_S3_S4 )
1906
+ if ( flags & CALIB_FIX_S1_S2_S3_S4 )
1903
1907
{
1904
1908
imask[12 ] = imask[NINTRINSIC+12 ] = 0 ;
1905
1909
imask[13 ] = imask[NINTRINSIC+13 ] = 0 ;
1906
1910
imask[14 ] = imask[NINTRINSIC+14 ] = 0 ;
1907
1911
imask[15 ] = imask[NINTRINSIC+15 ] = 0 ;
1908
1912
}
1909
- if ( flags & CV_CALIB_FIX_TAUX_TAUY )
1913
+ if ( flags & CALIB_FIX_TAUX_TAUY )
1910
1914
{
1911
1915
imask[16 ] = imask[NINTRINSIC+16 ] = 0 ;
1912
1916
imask[17 ] = imask[NINTRINSIC+17 ] = 0 ;
@@ -1977,7 +1981,7 @@ double cvStereoCalibrate( const CvMat* _objectPoints, const CvMat* _imagePoints1
1977
1981
for ( k = 0 ; k < 2 ; k++ )
1978
1982
{
1979
1983
double * iparam = solver.param ->data .db + (nimages+1 )*6 + k*NINTRINSIC;
1980
- if ( flags & CV_CALIB_ZERO_TANGENT_DIST )
1984
+ if ( flags & CALIB_ZERO_TANGENT_DIST )
1981
1985
dk[k][2 ] = dk[k][3 ] = 0 ;
1982
1986
iparam[0 ] = A[k][0 ]; iparam[1 ] = A[k][4 ]; iparam[2 ] = A[k][2 ]; iparam[3 ] = A[k][5 ];
1983
1987
iparam[4 ] = dk[k][0 ]; iparam[5 ] = dk[k][1 ]; iparam[6 ] = dk[k][2 ];
@@ -2027,14 +2031,14 @@ double cvStereoCalibrate( const CvMat* _objectPoints, const CvMat* _imagePoints1
2027
2031
dpdf = &dpdf_hdr;
2028
2032
dpdc = &dpdc_hdr;
2029
2033
dpdk = &dpdk_hdr;
2030
- if ( flags & CV_CALIB_SAME_FOCAL_LENGTH )
2034
+ if ( flags & CALIB_SAME_FOCAL_LENGTH )
2031
2035
{
2032
2036
iparam[NINTRINSIC] = iparam[0 ];
2033
2037
iparam[NINTRINSIC+1 ] = iparam[1 ];
2034
2038
ipparam[NINTRINSIC] = ipparam[0 ];
2035
2039
ipparam[NINTRINSIC+1 ] = ipparam[1 ];
2036
2040
}
2037
- if ( flags & CV_CALIB_FIX_ASPECT_RATIO )
2041
+ if ( flags & CALIB_FIX_ASPECT_RATIO )
2038
2042
{
2039
2043
iparam[0 ] = iparam[1 ]*aspectRatio[0 ];
2040
2044
iparam[NINTRINSIC] = iparam[NINTRINSIC+1 ]*aspectRatio[1 ];
@@ -2096,7 +2100,7 @@ double cvStereoCalibrate( const CvMat* _objectPoints, const CvMat* _imagePoints1
2096
2100
if ( JtJ || JtErr )
2097
2101
cvProjectPoints2 ( &objpt_i, &om[k], &T[k], &K[k], &Dist[k],
2098
2102
&tmpimagePoints, dpdrot, dpdt, dpdf, dpdc, dpdk,
2099
- (flags & CV_CALIB_FIX_ASPECT_RATIO ) ? aspectRatio[k] : 0 );
2103
+ (flags & CALIB_FIX_ASPECT_RATIO ) ? aspectRatio[k] : 0 );
2100
2104
else
2101
2105
cvProjectPoints2 ( &objpt_i, &om[k], &T[k], &K[k], &Dist[k], &tmpimagePoints );
2102
2106
cvSub ( &tmpimagePoints, &imgpt_i[k], &tmpimagePoints );
@@ -2372,7 +2376,7 @@ void cvStereoRectify( const CvMat* _cameraMatrix1, const CvMat* _cameraMatrix2,
2372
2376
2373
2377
// For simplicity, set the principal points for both cameras to be the average
2374
2378
// of the two principal points (either one of or both x- and y- coordinates)
2375
- if ( flags & CV_CALIB_ZERO_DISPARITY )
2379
+ if ( flags & CALIB_ZERO_DISPARITY )
2376
2380
{
2377
2381
cc_new[0 ].x = cc_new[1 ].x = (cc_new[0 ].x + cc_new[1 ].x )*0.5 ;
2378
2382
cc_new[0 ].y = cc_new[1 ].y = (cc_new[0 ].y + cc_new[1 ].y )*0.5 ;
0 commit comments