fixed defects from coverity.com

This commit is contained in:
Ilya Lavrenov
2014-02-23 14:59:06 +04:00
parent 0a90d6dde6
commit 32eb38ec98
27 changed files with 72 additions and 26 deletions

View File

@@ -1998,7 +1998,7 @@ bool cv::findCirclesGrid( InputArray _image, Size patternSize,
{
isFound = boxFinder.findHoles();
}
catch (cv::Exception)
catch (const cv::Exception &)
{
}

View File

@@ -57,6 +57,7 @@ CvLevMarq::CvLevMarq()
criteria = cvTermCriteria(0,0,0);
iters = 0;
completeSymmFlag = false;
errNorm = prevErrNorm = DBL_MAX;
}
CvLevMarq::CvLevMarq( int nparams, int nerrs, CvTermCriteria criteria0, bool _completeSymmFlag )
@@ -101,7 +102,7 @@ void CvLevMarq::init( int nparams, int nerrs, CvTermCriteria criteria0, bool _co
J.reset(cvCreateMat( nerrs, nparams, CV_64F ));
err.reset(cvCreateMat( nerrs, 1, CV_64F ));
}
prevErrNorm = DBL_MAX;
errNorm = prevErrNorm = DBL_MAX;
lambdaLg10 = -3;
criteria = criteria0;
if( criteria.type & CV_TERMCRIT_ITER )

View File

@@ -74,7 +74,6 @@ class epnp {
int number_of_correspondences;
double cws[4][3], ccs[4][3];
double cws_determinant;
int max_nr;
double * A1, * A2;
};

View File

@@ -260,7 +260,6 @@ public:
Ptr<PointSetRegistrator::Callback> cb;
int modelPoints;
int maxBasicSolutions;
bool checkPartialSubsets;
double threshold;
double confidence;

View File

@@ -1393,6 +1393,7 @@ void CV_StereoCalibrationTest::run( int )
{
ts->printf( cvtest::TS::LOG, "The file %s can not be opened or has invalid content\n", filepath.c_str() );
ts->set_failed_test_info( f ? cvtest::TS::FAIL_INVALID_TEST_DATA : cvtest::TS::FAIL_MISSING_TEST_DATA );
fclose(f);
return;
}

View File

@@ -85,7 +85,8 @@ Mat calcRvec(const vector<Point3f>& points, const Size& cornerSize)
class CV_CalibrateCameraArtificialTest : public cvtest::BaseTest
{
public:
CV_CalibrateCameraArtificialTest()
CV_CalibrateCameraArtificialTest() :
r(0)
{
}
~CV_CalibrateCameraArtificialTest() {}

View File

@@ -309,7 +309,8 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename )
progress = update_progress( progress, idx, max_idx, 0 );
}
sum_error /= count;
if (count != 0)
sum_error /= count;
ts->printf(cvtest::TS::LOG, "Average error is %f\n", sum_error);
}

View File

@@ -89,7 +89,14 @@ protected:
}
};
CV_ChessboardDetectorBadArgTest::CV_ChessboardDetectorBadArgTest() {}
CV_ChessboardDetectorBadArgTest::CV_ChessboardDetectorBadArgTest()
{
cpp = false;
flags = 0;
out_corners = NULL;
out_corner_count = NULL;
drawCorners = was_found = false;
}
/* ///////////////////// chess_corner_test ///////////////////////// */
void CV_ChessboardDetectorBadArgTest::run( int /*start_from */)

View File

@@ -211,6 +211,7 @@ void CV_ChessboardSubpixelTest::run( int )
progress = update_progress( progress, i-1, runs_count, 0 );
}
ASSERT_NE(0, count);
sum_dist /= count;
ts->printf(cvtest::TS::LOG, "Average error after findCornerSubpix: %f\n", sum_dist);

View File

@@ -808,6 +808,7 @@ CV_FundamentalMatTest::CV_FundamentalMatTest()
method = 0;
img_size = 10;
cube_size = 10;
dims = 0;
min_f = 1;
max_f = 3;
sigma = 0;//0.1;
@@ -1086,7 +1087,6 @@ protected:
int img_size;
int cube_size;
int dims;
int e_result;
double min_f, max_f;
double sigma;
};
@@ -1124,9 +1124,10 @@ CV_EssentialMatTest::CV_EssentialMatTest()
method = 0;
img_size = 10;
cube_size = 10;
dims = 0;
min_f = 1;
max_f = 3;
sigma = 0;
}

View File

@@ -75,6 +75,9 @@ CV_DefaultNewCameraMatrixTest::CV_DefaultNewCameraMatrixTest()
test_array[INPUT].push_back(NULL);
test_array[OUTPUT].push_back(NULL);
test_array[REF_OUTPUT].push_back(NULL);
matrix_type = 0;
center_principal_point = false;
}
void CV_DefaultNewCameraMatrixTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types )
@@ -200,6 +203,9 @@ CV_UndistortPointsTest::CV_UndistortPointsTest()
test_array[OUTPUT].push_back(NULL); // distorted dst points
test_array[TEMP].push_back(NULL); // dst points
test_array[REF_OUTPUT].push_back(NULL);
useCPlus = useDstMat = false;
zero_new_cam = zero_distortion = zero_R = false;
}
void CV_UndistortPointsTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types )
@@ -605,6 +611,11 @@ CV_InitUndistortRectifyMapTest::CV_InitUndistortRectifyMapTest()
test_array[INPUT].push_back(NULL); // new camera matrix
test_array[OUTPUT].push_back(NULL); // distorted dst points
test_array[REF_OUTPUT].push_back(NULL);
useCPlus = false;
zero_distortion = zero_new_cam = zero_R = false;
_mapx = _mapy = NULL;
mat_type = 0;
}
void CV_InitUndistortRectifyMapTest::get_test_array_types_and_sizes( int test_case_idx, vector<vector<Size> >& sizes, vector<vector<int> >& types )

View File

@@ -78,6 +78,8 @@ private:
CV_UndistortPointsBadArgTest::CV_UndistortPointsBadArgTest ()
{
useCPlus = false;
_camera_mat = matR = matP = _distortion_coeffs = _src_points = _dst_points = NULL;
}
void CV_UndistortPointsBadArgTest::run_func()
@@ -311,6 +313,8 @@ private:
CV_InitUndistortRectifyMapBadArgTest::CV_InitUndistortRectifyMapBadArgTest ()
{
useCPlus = false;
_camera_mat = matR = _new_camera_mat = _distortion_coeffs = _mapx = _mapy = NULL;
}
void CV_InitUndistortRectifyMapBadArgTest::run_func()
@@ -431,6 +435,8 @@ private:
CV_UndistortBadArgTest::CV_UndistortBadArgTest ()
{
useCPlus = false;
_camera_mat = _new_camera_mat = _distortion_coeffs = _src = _dst = NULL;
}
void CV_UndistortBadArgTest::run_func()