mirror of
https://github.com/opencv/opencv.git
synced 2025-08-05 22:19:14 +08:00
Merge pull request #23612 from cpoerschke:3.4-issue-21532
QRCodeDetector: don't floodFill with outside-of-image seedPoint #23612 Fixes #21532. ### 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 - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
parent
3f3c821800
commit
d00a96315e
@ -570,10 +570,11 @@ bool QRDetect::computeTransformationPoints()
|
||||
{
|
||||
Mat mask = Mat::zeros(bin_barcode.rows + 2, bin_barcode.cols + 2, CV_8UC1);
|
||||
uint8_t next_pixel, future_pixel = 255;
|
||||
int count_test_lines = 0, index = cvRound(localization_points[i].x);
|
||||
for (; index < bin_barcode.cols - 1; index++)
|
||||
int count_test_lines = 0, index_c = max(0, min(cvRound(localization_points[i].x), bin_barcode.cols - 1));
|
||||
const int index_r = max(0, min(cvRound(localization_points[i].y), bin_barcode.rows - 1));
|
||||
for (; index_c < bin_barcode.cols - 1; index_c++)
|
||||
{
|
||||
next_pixel = bin_barcode.ptr<uint8_t>(cvRound(localization_points[i].y))[index + 1];
|
||||
next_pixel = bin_barcode.ptr<uint8_t>(index_r)[index_c + 1];
|
||||
if (next_pixel == future_pixel)
|
||||
{
|
||||
future_pixel = static_cast<uint8_t>(~future_pixel);
|
||||
@ -581,7 +582,7 @@ bool QRDetect::computeTransformationPoints()
|
||||
if (count_test_lines == 2)
|
||||
{
|
||||
floodFill(bin_barcode, mask,
|
||||
Point(index + 1, cvRound(localization_points[i].y)), 255,
|
||||
Point(index_c + 1, index_r), 255,
|
||||
0, Scalar(), Scalar(), FLOODFILL_MASK_ONLY);
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user