Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1066,8 +1066,6 @@ bool FinderPatternFinder::handlePossibleCenter(int* stateCount, size_t i, size_t
}
float estimatedHorizontalModuleSize = (float)stateCountTotal / 7.0f;

float estimatedVerticalModuleSize;

// try different size according to the estimatedHorizontalModuleSize
float tolerateModuleSize =
estimatedHorizontalModuleSize > 4.0 ? estimatedHorizontalModuleSize / 2.0f : 1.0f;
Expand All @@ -1082,7 +1080,9 @@ bool FinderPatternFinder::handlePossibleCenter(int* stateCount, size_t i, size_t
int image_width = image_->getWidth();
for (int k = 0; k < CENTER_CHECK_TIME; k++) {
float possibleCenterJ = possbileCenterJs[k];
if (possibleCenterJ < 0 || possibleCenterJ >= image_width) continue;
if (possibleCenterJ < 0 || possibleCenterJ >= image_width)
continue;
float estimatedVerticalModuleSize = 0;
float centerI = crossCheckVertical(i, (size_t)possibleCenterJ, stateCount[2],
stateCountTotal, estimatedVerticalModuleSize);

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

} // namespace qrcode
} // namespace zxing
} // namespace zxing
6 changes: 3 additions & 3 deletions modules/wechat_qrcode/test/test_qrcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ TEST(Objdetect_QRCode_points_position, rotate45) {
Ptr<QRCodeEncoder> qrcode_enc = cv::QRCodeEncoder::create(params);
Mat qrImage;
qrcode_enc->encode(expect_msg, qrImage);
Mat image(800, 800, CV_8UC1);
Mat image(800, 800, CV_8UC1, Scalar(0));
const int pixInBlob = 4;
Size qrSize = Size((21+(params.version-1)*4)*pixInBlob,(21+(params.version-1)*4)*pixInBlob);
Rect2f rec(static_cast<float>((image.cols - qrSize.width)/2),
Expand Down Expand Up @@ -364,7 +364,7 @@ TEST(Objdetect_QRCode_Big, regression) {
Ptr<QRCodeEncoder> qrcode_enc = cv::QRCodeEncoder::create(params);
Mat qrImage;
qrcode_enc->encode(expect_msg, qrImage);
Mat largeImage(4032, 3024, CV_8UC1);
Mat largeImage(4032, 3024, CV_8UC1, Scalar(0));
const int pixInBlob = 4;
Size qrSize = Size((21+(params.version-1)*4)*pixInBlob,(21+(params.version-1)*4)*pixInBlob);
Mat roiImage = largeImage(Rect((largeImage.cols - qrSize.width)/2, (largeImage.rows - qrSize.height)/2,
Expand Down Expand Up @@ -395,7 +395,7 @@ TEST(Objdetect_QRCode_Tiny, regression) {
Ptr<QRCodeEncoder> qrcode_enc = cv::QRCodeEncoder::create(params);
Mat qrImage;
qrcode_enc->encode(expect_msg, qrImage);
Mat tinyImage(80, 80, CV_8UC1);
Mat tinyImage(80, 80, CV_8UC1, Scalar(0));
const int pixInBlob = 2;
Size qrSize = Size((21+(params.version-1)*4)*pixInBlob,(21+(params.version-1)*4)*pixInBlob);
Mat roiImage = tinyImage(Rect((tinyImage.cols - qrSize.width)/2, (tinyImage.rows - qrSize.height)/2,
Expand Down