Merge pull request #5774 from mshabunin:coverity_fixes
This commit is contained in:
commit
8e67f0ba84
@ -162,7 +162,8 @@ protected:
|
|||||||
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
|
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
|
||||||
}
|
}
|
||||||
|
|
||||||
image.create( 50, 50, CV_8UC3 );
|
RNG rng;
|
||||||
|
image = cvtest::randomMat(rng, Size(50, 50), CV_8UC3, 0, 255, false);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dextractor->compute( image, keypoints, descriptors );
|
dextractor->compute( image, keypoints, descriptors );
|
||||||
|
@ -381,6 +381,11 @@ bool ExrDecoder::readData( Mat& img )
|
|||||||
|
|
||||||
close();
|
close();
|
||||||
|
|
||||||
|
if( !m_native_depth || (!color && m_iscolor ))
|
||||||
|
{
|
||||||
|
delete[] buffer;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +270,11 @@ int JpegDecoder::getOrientation()
|
|||||||
ExifReader reader( m_filename );
|
ExifReader reader( m_filename );
|
||||||
if( reader.parse() )
|
if( reader.parse() )
|
||||||
{
|
{
|
||||||
orientation = reader.getTag( ORIENTATION ).field_u16;//orientation is unsigned short, so check field_u16
|
ExifEntry_t entry = reader.getTag( ORIENTATION );
|
||||||
|
if (entry.tag != INVALID_TAG)
|
||||||
|
{
|
||||||
|
orientation = entry.field_u16; //orientation is unsigned short, so check field_u16
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return orientation;
|
return orientation;
|
||||||
|
@ -52,10 +52,16 @@ namespace {
|
|||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
|
||||||
|
ExifEntry_t::ExifEntry_t() :
|
||||||
|
field_float(0), field_double(0), field_u32(0), field_s32(0),
|
||||||
|
tag(INVALID_TAG), field_u16(0), field_s16(0), field_u8(0), field_s8(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ExifReader constructor
|
* @brief ExifReader constructor
|
||||||
*/
|
*/
|
||||||
ExifReader::ExifReader(std::string filename) : m_filename(filename)
|
ExifReader::ExifReader(std::string filename) : m_filename(filename), m_format(NONE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +111,8 @@ typedef std::pair<uint32_t, uint32_t> u_rational_t;
|
|||||||
*/
|
*/
|
||||||
struct ExifEntry_t
|
struct ExifEntry_t
|
||||||
{
|
{
|
||||||
|
ExifEntry_t();
|
||||||
|
|
||||||
std::vector<u_rational_t> field_u_rational; ///< vector of rational fields
|
std::vector<u_rational_t> field_u_rational; ///< vector of rational fields
|
||||||
std::string field_str; ///< any kind of textual information
|
std::string field_str; ///< any kind of textual information
|
||||||
|
|
||||||
|
@ -2331,10 +2331,10 @@ static void addChildContour(InputArrayOfArrays contours,
|
|||||||
|
|
||||||
int h_next = hierarchy[i][0], h_prev = hierarchy[i][1],
|
int h_next = hierarchy[i][0], h_prev = hierarchy[i][1],
|
||||||
v_next = hierarchy[i][2], v_prev = hierarchy[i][3];
|
v_next = hierarchy[i][2], v_prev = hierarchy[i][3];
|
||||||
seq[i].h_next = (size_t)h_next < ncontours ? &seq[h_next] : 0;
|
seq[i].h_next = (0 <= h_next && h_next < (int)ncontours) ? &seq[h_next] : 0;
|
||||||
seq[i].h_prev = (size_t)h_prev < ncontours ? &seq[h_prev] : 0;
|
seq[i].h_prev = (0 <= h_prev && h_prev < (int)ncontours) ? &seq[h_prev] : 0;
|
||||||
seq[i].v_next = (size_t)v_next < ncontours ? &seq[v_next] : 0;
|
seq[i].v_next = (0 <= v_next && v_next < (int)ncontours) ? &seq[v_next] : 0;
|
||||||
seq[i].v_prev = (size_t)v_prev < ncontours ? &seq[v_prev] : 0;
|
seq[i].v_prev = (0 <= v_prev && v_prev < (int)ncontours) ? &seq[v_prev] : 0;
|
||||||
|
|
||||||
if( v_next >= 0 )
|
if( v_next >= 0 )
|
||||||
addChildContour(contours, ncontours, hierarchy, v_next, seq, block);
|
addChildContour(contours, ncontours, hierarchy, v_next, seq, block);
|
||||||
|
@ -320,7 +320,6 @@ protected:
|
|||||||
void run_func();
|
void run_func();
|
||||||
int validate_test_results( int test_case_idx );
|
int validate_test_results( int test_case_idx );
|
||||||
|
|
||||||
int aperture_size;
|
|
||||||
Mat src, src_gray;
|
Mat src, src_gray;
|
||||||
Mat src_gray32f, src_gray8U;
|
Mat src_gray32f, src_gray8U;
|
||||||
Mat mask;
|
Mat mask;
|
||||||
@ -348,7 +347,7 @@ CV_GoodFeatureToTTest::CV_GoodFeatureToTTest()
|
|||||||
k = 0.04;
|
k = 0.04;
|
||||||
mask = Mat();
|
mask = Mat();
|
||||||
test_case_count = 4;
|
test_case_count = 4;
|
||||||
|
SrcType = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CV_GoodFeatureToTTest::prepare_test_case( int test_case_idx )
|
int CV_GoodFeatureToTTest::prepare_test_case( int test_case_idx )
|
||||||
|
@ -510,8 +510,11 @@ protected:
|
|||||||
|
|
||||||
void calculateSum(std::vector<Mat>& x_contrast, std::vector<Mat>& y_contrast, Mat& sum)
|
void calculateSum(std::vector<Mat>& x_contrast, std::vector<Mat>& y_contrast, Mat& sum)
|
||||||
{
|
{
|
||||||
sum = Mat::zeros(x_contrast[x_contrast.size() - 1].size(), CV_32F);
|
if (x_contrast.empty())
|
||||||
for(int i = (int)x_contrast.size() - 1; i >= 0; i--)
|
return;
|
||||||
|
const int last = (int)x_contrast.size() - 1;
|
||||||
|
sum = Mat::zeros(x_contrast[last].size(), CV_32F);
|
||||||
|
for(int i = last; i >= 0; i--)
|
||||||
{
|
{
|
||||||
Mat grad_x, grad_y;
|
Mat grad_x, grad_y;
|
||||||
getGradient(x_contrast[i], grad_x, 1);
|
getGradient(x_contrast[i], grad_x, 1);
|
||||||
|
@ -82,6 +82,11 @@ Stitcher Stitcher::createDefault(bool try_use_gpu)
|
|||||||
stitcher.setExposureCompensator(makePtr<detail::BlocksGainCompensator>());
|
stitcher.setExposureCompensator(makePtr<detail::BlocksGainCompensator>());
|
||||||
stitcher.setBlender(makePtr<detail::MultiBandBlender>(try_use_gpu));
|
stitcher.setBlender(makePtr<detail::MultiBandBlender>(try_use_gpu));
|
||||||
|
|
||||||
|
stitcher.work_scale_ = 1;
|
||||||
|
stitcher.seam_scale_ = 1;
|
||||||
|
stitcher.seam_work_aspect_ = 1;
|
||||||
|
stitcher.warped_image_scale_ = 1;
|
||||||
|
|
||||||
return stitcher;
|
return stitcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1133,18 +1133,22 @@ void EstimateDualVariablesBody::operator() (const Range& range) const
|
|||||||
{
|
{
|
||||||
const float g1 = static_cast<float>(hypot(u1xRow[x], u1yRow[x]));
|
const float g1 = static_cast<float>(hypot(u1xRow[x], u1yRow[x]));
|
||||||
const float g2 = static_cast<float>(hypot(u2xRow[x], u2yRow[x]));
|
const float g2 = static_cast<float>(hypot(u2xRow[x], u2yRow[x]));
|
||||||
const float g3 = static_cast<float>(hypot(u3xRow[x], u3yRow[x]));
|
|
||||||
|
|
||||||
const float ng1 = 1.0f + taut * g1;
|
const float ng1 = 1.0f + taut * g1;
|
||||||
const float ng2 = 1.0f + taut * g2;
|
const float ng2 = 1.0f + taut * g2;
|
||||||
const float ng3 = 1.0f + taut * g3;
|
|
||||||
|
|
||||||
p11Row[x] = (p11Row[x] + taut * u1xRow[x]) / ng1;
|
p11Row[x] = (p11Row[x] + taut * u1xRow[x]) / ng1;
|
||||||
p12Row[x] = (p12Row[x] + taut * u1yRow[x]) / ng1;
|
p12Row[x] = (p12Row[x] + taut * u1yRow[x]) / ng1;
|
||||||
p21Row[x] = (p21Row[x] + taut * u2xRow[x]) / ng2;
|
p21Row[x] = (p21Row[x] + taut * u2xRow[x]) / ng2;
|
||||||
p22Row[x] = (p22Row[x] + taut * u2yRow[x]) / ng2;
|
p22Row[x] = (p22Row[x] + taut * u2yRow[x]) / ng2;
|
||||||
if (use_gamma) p31Row[x] = (p31Row[x] + taut * u3xRow[x]) / ng3;
|
|
||||||
if (use_gamma) p32Row[x] = (p32Row[x] + taut * u3yRow[x]) / ng3;
|
if (use_gamma)
|
||||||
|
{
|
||||||
|
const float g3 = static_cast<float>(hypot(u3xRow[x], u3yRow[x]));
|
||||||
|
const float ng3 = 1.0f + taut * g3;
|
||||||
|
p31Row[x] = (p31Row[x] + taut * u3xRow[x]) / ng3;
|
||||||
|
p32Row[x] = (p32Row[x] + taut * u3yRow[x]) / ng3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user