mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 11:10:21 +08:00
fixed defects from coverity.com
This commit is contained in:
parent
0a90d6dde6
commit
32eb38ec98
@ -1998,7 +1998,7 @@ bool cv::findCirclesGrid( InputArray _image, Size patternSize,
|
||||
{
|
||||
isFound = boxFinder.findHoles();
|
||||
}
|
||||
catch (cv::Exception)
|
||||
catch (const cv::Exception &)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -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 )
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -260,7 +260,6 @@ public:
|
||||
|
||||
Ptr<PointSetRegistrator::Callback> cb;
|
||||
int modelPoints;
|
||||
int maxBasicSolutions;
|
||||
bool checkPartialSubsets;
|
||||
double threshold;
|
||||
double confidence;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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() {}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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 */)
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 )
|
||||
|
@ -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()
|
||||
|
@ -55,7 +55,7 @@ class CV_EXPORTS Octree
|
||||
public:
|
||||
struct Node
|
||||
{
|
||||
Node() {}
|
||||
Node() { memset(this, 0, sizeof(Node)); }
|
||||
int begin, end;
|
||||
float x_min, x_max, y_min, y_max, z_min, z_max;
|
||||
int maxLevels;
|
||||
|
@ -340,6 +340,8 @@ class CV_EXPORTS CommandLineParser
|
||||
CommandLineParser(const CommandLineParser& parser);
|
||||
CommandLineParser& operator = (const CommandLineParser& parser);
|
||||
|
||||
~CommandLineParser();
|
||||
|
||||
String getPathToApplication() const;
|
||||
|
||||
template <typename T>
|
||||
|
@ -237,6 +237,11 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const S
|
||||
impl->sort_params();
|
||||
}
|
||||
|
||||
CommandLineParser::~CommandLineParser()
|
||||
{
|
||||
if (CV_XADD(&impl->refcount, -1) == 1)
|
||||
delete impl;
|
||||
}
|
||||
|
||||
CommandLineParser::CommandLineParser(const CommandLineParser& parser)
|
||||
{
|
||||
|
@ -2641,9 +2641,9 @@ KernelArg KernelArg::Constant(const Mat& m)
|
||||
|
||||
struct Kernel::Impl
|
||||
{
|
||||
Impl(const char* kname, const Program& prog)
|
||||
Impl(const char* kname, const Program& prog) :
|
||||
refcount(1), e(0), nu(0)
|
||||
{
|
||||
e = 0; refcount = 1;
|
||||
cl_program ph = (cl_program)prog.ptr();
|
||||
cl_int retval = 0;
|
||||
handle = ph != 0 ?
|
||||
|
@ -18,7 +18,7 @@ struct BaseElemWiseOp
|
||||
BaseElemWiseOp(int _ninputs, int _flags, double _alpha, double _beta,
|
||||
Scalar _gamma=Scalar::all(0), int _context=1)
|
||||
: ninputs(_ninputs), flags(_flags), alpha(_alpha), beta(_beta), gamma(_gamma), context(_context) {}
|
||||
BaseElemWiseOp() { flags = 0; alpha = beta = 0; gamma = Scalar::all(0); }
|
||||
BaseElemWiseOp() { flags = 0; alpha = beta = 0; gamma = Scalar::all(0); ninputs = 0; context = 1; }
|
||||
virtual ~BaseElemWiseOp() {}
|
||||
virtual void op(const vector<Mat>&, Mat&, const Mat&) {}
|
||||
virtual void refop(const vector<Mat>&, Mat&, const Mat&) {}
|
||||
@ -89,7 +89,6 @@ struct BaseElemWiseOp
|
||||
double alpha;
|
||||
double beta;
|
||||
Scalar gamma;
|
||||
int maxErr;
|
||||
int context;
|
||||
};
|
||||
|
||||
@ -409,7 +408,7 @@ struct MaxSOp : public BaseElemWiseOp
|
||||
|
||||
struct CmpOp : public BaseElemWiseOp
|
||||
{
|
||||
CmpOp() : BaseElemWiseOp(2, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) {}
|
||||
CmpOp() : BaseElemWiseOp(2, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) { cmpop = 0; }
|
||||
void generateScalars(int depth, RNG& rng)
|
||||
{
|
||||
BaseElemWiseOp::generateScalars(depth, rng);
|
||||
@ -437,7 +436,7 @@ struct CmpOp : public BaseElemWiseOp
|
||||
|
||||
struct CmpSOp : public BaseElemWiseOp
|
||||
{
|
||||
CmpSOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+REAL_GAMMA, 1, 1, Scalar::all(0)) {}
|
||||
CmpSOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+REAL_GAMMA, 1, 1, Scalar::all(0)) { cmpop = 0; }
|
||||
void generateScalars(int depth, RNG& rng)
|
||||
{
|
||||
BaseElemWiseOp::generateScalars(depth, rng);
|
||||
@ -467,7 +466,7 @@ struct CmpSOp : public BaseElemWiseOp
|
||||
|
||||
struct CopyOp : public BaseElemWiseOp
|
||||
{
|
||||
CopyOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA+SUPPORT_MASK, 1, 1, Scalar::all(0)) {}
|
||||
CopyOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA+SUPPORT_MASK, 1, 1, Scalar::all(0)) { }
|
||||
void op(const vector<Mat>& src, Mat& dst, const Mat& mask)
|
||||
{
|
||||
src[0].copyTo(dst, mask);
|
||||
@ -484,7 +483,6 @@ struct CopyOp : public BaseElemWiseOp
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int cmpop;
|
||||
};
|
||||
|
||||
|
||||
@ -810,7 +808,7 @@ static void setIdentity(Mat& dst, const Scalar& s)
|
||||
|
||||
struct FlipOp : public BaseElemWiseOp
|
||||
{
|
||||
FlipOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) {}
|
||||
FlipOp() : BaseElemWiseOp(1, FIX_ALPHA+FIX_BETA+FIX_GAMMA, 1, 1, Scalar::all(0)) { flipcode = 0; }
|
||||
void getRandomSize(RNG& rng, vector<int>& size)
|
||||
{
|
||||
cvtest::randomSize(rng, 2, 2, cvtest::ARITHM_MAX_SIZE_LOG, size);
|
||||
|
@ -617,6 +617,7 @@ Core_GEMMTest::Core_GEMMTest() : Core_MatrixTest( 5, 1, false, false, 2 )
|
||||
{
|
||||
test_case_count = 100;
|
||||
max_log_array_size = 10;
|
||||
tabc_flag = 0;
|
||||
alpha = beta = 0;
|
||||
}
|
||||
|
||||
@ -821,6 +822,8 @@ protected:
|
||||
|
||||
Core_TransformTest::Core_TransformTest() : Core_MatrixTest( 3, 1, true, false, 4 )
|
||||
{
|
||||
scale = 1;
|
||||
diagMtx = false;
|
||||
}
|
||||
|
||||
|
||||
@ -1154,7 +1157,7 @@ protected:
|
||||
|
||||
|
||||
Core_CovarMatrixTest::Core_CovarMatrixTest() : Core_MatrixTest( 1, 1, true, false, 1 ),
|
||||
flags(0), t_flag(0), are_images(false)
|
||||
flags(0), t_flag(0), len(0), count(0), are_images(false)
|
||||
{
|
||||
test_case_count = 100;
|
||||
test_array[INPUT_OUTPUT].push_back(NULL);
|
||||
|
@ -44,7 +44,7 @@
|
||||
namespace cv
|
||||
{
|
||||
|
||||
BOWTrainer::BOWTrainer()
|
||||
BOWTrainer::BOWTrainer() : size(0)
|
||||
{}
|
||||
|
||||
BOWTrainer::~BOWTrainer()
|
||||
|
@ -224,6 +224,8 @@ BRISK::BRISK(std::vector<float> &radiusList, std::vector<int> &numberList, float
|
||||
std::vector<int> indexChange)
|
||||
{
|
||||
generateKernel(radiusList, numberList, dMax, dMin, indexChange);
|
||||
threshold = 20;
|
||||
octaves = 3;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -540,8 +540,6 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize,
|
||||
int wtype = CV_MAKETYPE(wdepth, src.channels());
|
||||
Mat kd, ks;
|
||||
getSobelKernels( kd, ks, 2, 0, ksize, false, ktype );
|
||||
if( ddepth < 0 )
|
||||
ddepth = src.depth();
|
||||
int dtype = CV_MAKETYPE(ddepth, src.channels());
|
||||
|
||||
int dy0 = std::min(std::max((int)(STRIPE_SIZE/(getElemSize(src.type())*src.cols)), 1), src.rows);
|
||||
|
@ -1405,7 +1405,11 @@ struct SymmColumnVec_32f16s
|
||||
|
||||
struct RowVec_32f
|
||||
{
|
||||
RowVec_32f() {}
|
||||
RowVec_32f()
|
||||
{
|
||||
haveSSE = checkHardwareSupport(CV_CPU_SSE);
|
||||
}
|
||||
|
||||
RowVec_32f( const Mat& _kernel )
|
||||
{
|
||||
kernel = _kernel;
|
||||
|
@ -99,6 +99,8 @@ CV_ColorCvtBaseTest::CV_ColorCvtBaseTest( bool _custom_inv_transform, bool _allo
|
||||
|
||||
test_cpp = false;
|
||||
hue_range = 0;
|
||||
blue_idx = 0;
|
||||
inplace = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -351,7 +351,7 @@ namespace cv
|
||||
{
|
||||
struct DTreeBestSplitFinder
|
||||
{
|
||||
DTreeBestSplitFinder(){ tree = 0; node = 0; }
|
||||
DTreeBestSplitFinder(){ splitSize = 0, tree = 0; node = 0; }
|
||||
DTreeBestSplitFinder( CvDTree* _tree, CvDTreeNode* _node);
|
||||
DTreeBestSplitFinder( const DTreeBestSplitFinder& finder, Split );
|
||||
virtual ~DTreeBestSplitFinder() {}
|
||||
|
@ -2897,7 +2897,7 @@ static std::ostream& operator << (std::ostream& out, const MatPart& m)
|
||||
}
|
||||
|
||||
MatComparator::MatComparator(double _maxdiff, int _context)
|
||||
: maxdiff(_maxdiff), context(_context) {}
|
||||
: maxdiff(_maxdiff), realmaxdiff(DBL_MAX), context(_context) {}
|
||||
|
||||
::testing::AssertionResult
|
||||
MatComparator::operator()(const char* expr1, const char* expr2,
|
||||
|
@ -855,6 +855,9 @@ int64 TestBase::_calibrate()
|
||||
#endif
|
||||
TestBase::TestBase(): testStrategy(PERF_STRATEGY_DEFAULT), declare(this)
|
||||
{
|
||||
lastTime = totalTime = timeLimit = 0;
|
||||
nIters = currentIter = runsPerIteration = 0;
|
||||
verified = false;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
|
@ -429,6 +429,7 @@ static inline float extrapolateValueInRect(int height, int width,
|
||||
if (r == height && c == 0) { return v21;}
|
||||
if (r == height && c == width) { return v22;}
|
||||
|
||||
CV_Assert(height > 0 && width > 0);
|
||||
float qr = float(r) / height;
|
||||
float pr = 1.0f - qr;
|
||||
float qc = float(c) / width;
|
||||
|
Loading…
Reference in New Issue
Block a user