From f1aae52daf66b85e80e446aadc51ec44e935124d Mon Sep 17 00:00:00 2001 From: Tomoaki Teshima Date: Tue, 18 Oct 2016 10:23:47 +0900 Subject: [PATCH] clean up unused #if --- modules/calib3d/src/compat_ptsetreg.cpp | 4 --- modules/calib3d/src/fisheye.cpp | 24 ---------------- modules/calib3d/src/triangulate.cpp | 46 ------------------------------ modules/calib3d/test/test_chesscorners.cpp | 10 ------- 4 files changed, 84 deletions(-) diff --git a/modules/calib3d/src/compat_ptsetreg.cpp b/modules/calib3d/src/compat_ptsetreg.cpp index 774129e..6e67000 100644 --- a/modules/calib3d/src/compat_ptsetreg.cpp +++ b/modules/calib3d/src/compat_ptsetreg.cpp @@ -313,11 +313,7 @@ void CvLevMarq::step() if( !err ) completeSymm( _JtJN, completeSymmFlag ); -#if 1 _JtJN.diag() *= 1. + lambda; -#else - _JtJN.diag() += lambda; -#endif solve(_JtJN, _JtErr, nonzero_param, solveMethod); int j = 0; diff --git a/modules/calib3d/src/fisheye.cpp b/modules/calib3d/src/fisheye.cpp index 32dc15c..2b65d6b 100644 --- a/modules/calib3d/src/fisheye.cpp +++ b/modules/calib3d/src/fisheye.cpp @@ -542,19 +542,6 @@ void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, Input pptr[6] = Vec2d(0, h); pptr[7] = Vec2d(0, h/2); -#if 0 - const int N = 10; - cv::Mat points(1, N * 4, CV_64FC2); - Vec2d* pptr = points.ptr(); - for(int i = 0, k = 0; i < 10; ++i) - { - pptr[k++] = Vec2d(w/2, 0) - Vec2d(w/8, 0) + Vec2d(w/4/N*i, 0); - pptr[k++] = Vec2d(w/2, h-1) - Vec2d(w/8, h-1) + Vec2d(w/4/N*i, h-1); - pptr[k++] = Vec2d(0, h/2) - Vec2d(0, h/8) + Vec2d(0, h/4/N*i); - pptr[k++] = Vec2d(w-1, h/2) - Vec2d(w-1, h/8) + Vec2d(w-1, h/4/N*i); - } -#endif - fisheye::undistortPoints(points, points, K, D, R); cv::Scalar center_mass = mean(points); cv::Vec2d cn(center_mass.val); @@ -580,17 +567,6 @@ void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(InputArray K, Input maxx = std::max(maxx, std::abs(pptr[i][0]-cn[0])); } -#if 0 - double minx = -DBL_MAX, miny = -DBL_MAX, maxx = DBL_MAX, maxy = DBL_MAX; - for(size_t i = 0; i < points.total(); ++i) - { - if (i % 4 == 0) miny = std::max(miny, pptr[i][1]); - if (i % 4 == 1) maxy = std::min(maxy, pptr[i][1]); - if (i % 4 == 2) minx = std::max(minx, pptr[i][0]); - if (i % 4 == 3) maxx = std::min(maxx, pptr[i][0]); - } -#endif - double f1 = w * 0.5/(minx); double f2 = w * 0.5/(maxx); double f3 = h * 0.5 * aspect_ratio/(miny); diff --git a/modules/calib3d/src/triangulate.cpp b/modules/calib3d/src/triangulate.cpp index 33c7fd7..5bdf10e 100644 --- a/modules/calib3d/src/triangulate.cpp +++ b/modules/calib3d/src/triangulate.cpp @@ -114,52 +114,6 @@ cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2, CvMat* projPoints1, CvMa cvmSet(points4D,2,i,matrV(3,2));/* Z */ cvmSet(points4D,3,i,matrV(3,3));/* W */ } - -#if 0 - double err = 0; - /* Points was reconstructed. Try to reproject points */ - /* We can compute reprojection error if need */ - { - int i; - CvMat point3D; - double point3D_dat[4]; - point3D = cvMat(4,1,CV_64F,point3D_dat); - - CvMat point2D; - double point2D_dat[3]; - point2D = cvMat(3,1,CV_64F,point2D_dat); - - for( i = 0; i < numPoints; i++ ) - { - double W = cvmGet(points4D,3,i); - - point3D_dat[0] = cvmGet(points4D,0,i)/W; - point3D_dat[1] = cvmGet(points4D,1,i)/W; - point3D_dat[2] = cvmGet(points4D,2,i)/W; - point3D_dat[3] = 1; - - /* !!! Project this point for each camera */ - for( int currCamera = 0; currCamera < 2; currCamera++ ) - { - cvMatMul(projMatrs[currCamera], &point3D, &point2D); - - float x,y; - float xr,yr,wr; - x = (float)cvmGet(projPoints[currCamera],0,i); - y = (float)cvmGet(projPoints[currCamera],1,i); - - wr = (float)point2D_dat[2]; - xr = (float)(point2D_dat[0]/wr); - yr = (float)(point2D_dat[1]/wr); - - float deltaX,deltaY; - deltaX = (float)fabs(x-xr); - deltaY = (float)fabs(y-yr); - err += deltaX*deltaX + deltaY*deltaY; - } - } - } -#endif } diff --git a/modules/calib3d/test/test_chesscorners.cpp b/modules/calib3d/test/test_chesscorners.cpp index 781eec2..64a2d69 100644 --- a/modules/calib3d/test/test_chesscorners.cpp +++ b/modules/calib3d/test/test_chesscorners.cpp @@ -268,14 +268,6 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename ) #ifndef WRITE_POINTS double err = calcError(v, expected); -#if 0 - if( err > rough_success_error_level ) - { - ts.printf( cvtest::TS::LOG, "bad accuracy of corner guesses\n" ); - ts.set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY ); - continue; - } -#endif max_rough_error = MAX( max_rough_error, err ); #endif if( pattern == CHESSBOARD ) @@ -287,14 +279,12 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename ) err = calcError(v, expected); sum_error += err; count++; -#if 1 if( err > precise_success_error_level ) { ts->printf( cvtest::TS::LOG, "Image %s: bad accuracy of adjusted corners %f\n", img_file.c_str(), err ); ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY ); return; } -#endif ts->printf(cvtest::TS::LOG, "Error on %s is %f\n", img_file.c_str(), err); max_precise_error = MAX( max_precise_error, err ); #endif -- 2.7.4