Skip to content

Commit 270d2aa

Browse files
committed
wechat: fix uninitialized values in tests
1 parent bf95e79 commit 270d2aa

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

modules/wechat_qrcode/src/zxing/qrcode/detector/finder_pattern_finder.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,8 +1066,6 @@ bool FinderPatternFinder::handlePossibleCenter(int* stateCount, size_t i, size_t
10661066
}
10671067
float estimatedHorizontalModuleSize = (float)stateCountTotal / 7.0f;
10681068

1069-
float estimatedVerticalModuleSize;
1070-
10711069
// try different size according to the estimatedHorizontalModuleSize
10721070
float tolerateModuleSize =
10731071
estimatedHorizontalModuleSize > 4.0 ? estimatedHorizontalModuleSize / 2.0f : 1.0f;
@@ -1082,7 +1080,9 @@ bool FinderPatternFinder::handlePossibleCenter(int* stateCount, size_t i, size_t
10821080
int image_width = image_->getWidth();
10831081
for (int k = 0; k < CENTER_CHECK_TIME; k++) {
10841082
float possibleCenterJ = possbileCenterJs[k];
1085-
if (possibleCenterJ < 0 || possibleCenterJ >= image_width) continue;
1083+
if (possibleCenterJ < 0 || possibleCenterJ >= image_width)
1084+
continue;
1085+
float estimatedVerticalModuleSize = 0;
10861086
float centerI = crossCheckVertical(i, (size_t)possibleCenterJ, stateCount[2],
10871087
stateCountTotal, estimatedVerticalModuleSize);
10881088

@@ -1505,4 +1505,4 @@ Ref<BitMatrix> FinderPatternFinder::getImage() { return image_; }
15051505
vector<Ref<FinderPattern>>& FinderPatternFinder::getPossibleCenters() { return possibleCenters_; }
15061506

15071507
} // namespace qrcode
1508-
} // namespace zxing
1508+
} // namespace zxing

modules/wechat_qrcode/test/test_qrcode.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ TEST(Objdetect_QRCode_points_position, rotate45) {
303303
Ptr<QRCodeEncoder> qrcode_enc = cv::QRCodeEncoder::create(params);
304304
Mat qrImage;
305305
qrcode_enc->encode(expect_msg, qrImage);
306-
Mat image(800, 800, CV_8UC1);
306+
Mat image(800, 800, CV_8UC1, Scalar(0));
307307
const int pixInBlob = 4;
308308
Size qrSize = Size((21+(params.version-1)*4)*pixInBlob,(21+(params.version-1)*4)*pixInBlob);
309309
Rect2f rec(static_cast<float>((image.cols - qrSize.width)/2),
@@ -364,7 +364,7 @@ TEST(Objdetect_QRCode_Big, regression) {
364364
Ptr<QRCodeEncoder> qrcode_enc = cv::QRCodeEncoder::create(params);
365365
Mat qrImage;
366366
qrcode_enc->encode(expect_msg, qrImage);
367-
Mat largeImage(4032, 3024, CV_8UC1);
367+
Mat largeImage(4032, 3024, CV_8UC1, Scalar(0));
368368
const int pixInBlob = 4;
369369
Size qrSize = Size((21+(params.version-1)*4)*pixInBlob,(21+(params.version-1)*4)*pixInBlob);
370370
Mat roiImage = largeImage(Rect((largeImage.cols - qrSize.width)/2, (largeImage.rows - qrSize.height)/2,
@@ -395,7 +395,7 @@ TEST(Objdetect_QRCode_Tiny, regression) {
395395
Ptr<QRCodeEncoder> qrcode_enc = cv::QRCodeEncoder::create(params);
396396
Mat qrImage;
397397
qrcode_enc->encode(expect_msg, qrImage);
398-
Mat tinyImage(80, 80, CV_8UC1);
398+
Mat tinyImage(80, 80, CV_8UC1, Scalar(0));
399399
const int pixInBlob = 2;
400400
Size qrSize = Size((21+(params.version-1)*4)*pixInBlob,(21+(params.version-1)*4)*pixInBlob);
401401
Mat roiImage = tinyImage(Rect((tinyImage.cols - qrSize.width)/2, (tinyImage.rows - qrSize.height)/2,

0 commit comments

Comments
 (0)