Fixs several problems found by static analysis

pull/16824/head
Maksim Shabunin 5 years ago
parent 2a52e44bc6
commit 7e7bb3027c
  1. 4
      modules/calib3d/src/chessboard.cpp
  2. 1
      modules/core/src/persistence.cpp
  3. 1
      modules/features2d/src/kaze/AKAZEFeatures.cpp
  4. 2
      modules/objdetect/src/qrcode.cpp

@ -2215,11 +2215,13 @@ int Chessboard::Board::detectMarkers(cv::InputArray image)
cv::Mat mask = cv::Mat::zeros(DUMMY_FIELD_SIZE,DUMMY_FIELD_SIZE,CV_8UC1);
cv::circle(mask,cv::Point(DUMMY_FIELD_SIZE/2,DUMMY_FIELD_SIZE/2),DUMMY_FIELD_SIZE/7,cv::Scalar::all(255),-1);
int signal_size = cv::countNonZero(mask);
CV_Assert(signal_size > 0);
cv::Mat mask2 = cv::Mat::zeros(DUMMY_FIELD_SIZE,DUMMY_FIELD_SIZE,CV_8UC1);
cv::circle(mask2,cv::Point(DUMMY_FIELD_SIZE/2,DUMMY_FIELD_SIZE/2),DUMMY_FIELD_SIZE/2,cv::Scalar::all(255),-1);
cv::circle(mask2,cv::Point(DUMMY_FIELD_SIZE/2,DUMMY_FIELD_SIZE/2),DUMMY_FIELD_SIZE/5,cv::Scalar::all(0),-1);
int noise_size = cv::countNonZero(mask2);
CV_Assert(noise_size > 0);
std::vector<cv::Point2f> dst,src;
dst.push_back(cv::Point2f(0.0F,0.0F));
@ -3369,7 +3371,7 @@ cv::Scalar Chessboard::Board::calcEdgeSharpness(cv::InputArray _img,float rise_d
value += patch.at<uint8_t>(0,0);
++count2;
}
values.push_back(uint8_t(value/count2));
values.push_back(count2 > 0 ? uint8_t(value/count2) : 0);
}
float val = calcSharpness(values,rise_distance);

@ -704,6 +704,7 @@ public:
const char* json_signature = "{";
const char* xml_signature = "<?xml";
char* buf = this->gets(16);
CV_Assert(buf);
char* bufPtr = cv_skip_BOM(buf);
size_t bufOffset = bufPtr - buf;

@ -1323,6 +1323,7 @@ void quantized_counting_sort(const float a[], const int n,
const float quantum, const int nkeys,
int idx[/*n*/], int cum[/*nkeys + 1*/])
{
CV_Assert(nkeys > 0);
memset(cum, 0, sizeof(cum[0]) * (nkeys + 1));
// Count up the quantized values

@ -1593,6 +1593,8 @@ bool QRDetectMulti::checkPoints(const vector<Point2f>& quadrangle_points)
li2++;
}
}
if (count_w == 0)
return false;
double frac = double(count_b) / double(count_w);
double bottom_bound = 0.76;

Loading…
Cancel
Save