1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

Merge pull request #24364 from bagelbytes61:bugfix/qrcode-version-estimator

Bugfix/qrcode version estimator #24364

Fixes https://github.com/opencv/opencv/issues/24366

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Jeremy Lyda
2023-11-16 08:28:28 -05:00
committed by GitHub
parent 8c10545d3c
commit fad0dbb9ac
2 changed files with 137 additions and 56 deletions
@@ -548,4 +548,22 @@ TEST(Objdetect_QRCode_Encode_Decode, regression_issue22029)
}
}
// This test reproduces issue https://github.com/opencv/opencv/issues/24366 only in a loop
TEST(Objdetect_QRCode_Encode_Decode, auto_version_pick)
{
cv::QRCodeEncoder::Params params;
params.correction_level = cv::QRCodeEncoder::CORRECT_LEVEL_L;
params.mode = cv::QRCodeEncoder::EncodeMode::MODE_AUTO;
cv::Ptr<cv::QRCodeEncoder> encoder = cv::QRCodeEncoder::create(params);
for (int len = 1; len < 19; len++) {
std::string input;
input.resize(len);
cv::randu(Mat(1, len, CV_8U, &input[0]), 'a', 'z' + 1);
cv::Mat qrcode;
encoder->encode(input, qrcode);
}
}
}} // namespace