Skip to content

Fix large image handling in WeChat QrCode detector #3287

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Aug 29, 2022

Conversation

AleksandrPanov
Copy link
Contributor

@AleksandrPanov AleksandrPanov commented Jun 17, 2022

Fixes #3282
Merge with opencv/opencv_extra#984

Pull Request Readiness Checklist

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

  • I agree to contribute to the project under Apache 2 License.
  • 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
  • The PR is proposed to the proper branch
  • 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

@AleksandrPanov AleksandrPanov self-assigned this Jun 21, 2022
@AleksandrPanov AleksandrPanov force-pushed the wechat_fix_large_img branch 2 times, most recently from 071649f to b07af9f Compare June 30, 2022 17:25
@AleksandrPanov AleksandrPanov marked this pull request as ready for review July 5, 2022 07:56
@AleksandrPanov AleksandrPanov force-pushed the wechat_fix_large_img branch from b07af9f to 017da1c Compare July 5, 2022 08:05
@AleksandrPanov AleksandrPanov force-pushed the wechat_fix_large_img branch from 017da1c to fe7dedd Compare July 5, 2022 11:44
@AleksandrPanov AleksandrPanov marked this pull request as draft July 5, 2022 14:02
@AleksandrPanov AleksandrPanov force-pushed the wechat_fix_large_img branch 2 times, most recently from 3ec273f to 26646b3 Compare July 5, 2022 15:45
@AleksandrPanov AleksandrPanov marked this pull request as ready for review July 7, 2022 23:16
@AleksandrPanov AleksandrPanov force-pushed the wechat_fix_large_img branch 2 times, most recently from 55f2a7c to 7f8d4c1 Compare July 28, 2022 10:03
float resizeRatio = sqrt(img_w * img_h * 1.0 / (minInputSize * minInputSize));
int detect_width = img_w / resizeRatio;
int detect_height = img_h / resizeRatio;
const float tmpScaleFactor = scaleFactor == -1.f ? sqrt(targetArea / (img_w * img_h)) : scaleFactor;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'll do upscale for small images like qvga 320x240. I propose to use original image size for it.

@asmorkalov asmorkalov changed the title fix large image Fix large image handling in WeChat QrCode detector Jul 28, 2022
@AleksandrPanov AleksandrPanov force-pushed the wechat_fix_large_img branch 3 times, most recently from adc6b43 to ab6ef02 Compare July 28, 2022 21:15
@asmorkalov asmorkalov self-assigned this Aug 15, 2022
@AleksandrPanov
Copy link
Contributor Author

@alalek,
Ubuntu2004-x64:
following models have not been downloaded: wechat_2021-01/detect.prototxt

default build:

C++ exception with description "OpenCV(4.6.0-dev) /build/precommit-contrib_linux64/4.x/opencv/modules/ts/src/ts.cpp:1064: error: (-2:Unspecified error) OpenCV tests: Can't find required data file: ../dnn/wechat_2021-01/detect.prototxt in function 'findData'

@AleksandrPanov AleksandrPanov force-pushed the wechat_fix_large_img branch 2 times, most recently from 921cb5e to 97a44dc Compare August 16, 2022 06:52
@AleksandrPanov AleksandrPanov requested a review from alalek August 17, 2022 13:04
@asmorkalov
Copy link
Contributor

@AleksandrPanov Please squash commits before merge.

add test

add dnn data search
@AleksandrPanov
Copy link
Contributor Author

@asmorkalov, all checks have passed

@asmorkalov asmorkalov merged commit 06e1f62 into opencv:4.x Aug 29, 2022
@AleksandrPanov AleksandrPanov deleted the wechat_fix_large_img branch September 12, 2022 08:21
@alalek alalek mentioned this pull request Jan 8, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

detectAndDecode() in WeChatQRCode not detected QR codes on large images (4032x3024)
3 participants