opencv_contrib icon indicating copy to clipboard operation
opencv_contrib copied to clipboard

WeChat QR code cannot detect and decode the QR code cropped from the image

Open donalduk opened this issue 3 years ago • 1 comments

System information (version)
  • OpenCV => 4.5.4
  • Operating System / Platform => Ubuntu 21.10
  • Compiler => GCC 11.2.0
Detailed description

I have built OpenCV 4.5.4 with WeChat QR code from the source code. Then I am trying to detect QR code with two sample QR codes. The 2dbarcode.jpeg is one QR code I downloaded from internet while the cropped-barcode.jpg is the QR code I cropped from one image. WeChat QR detector can detect and decode the QR code in 2dbarcode.jpeg. But it cannot detect the QR code in cropped-barcode.jpg. However If I use one QR Code app in my mobile to scan the cropped-barcode.jpg and the QR code mobile app can correctly detect and decode the QR Code in the cropped-barcode.jpg.

What should I need to do in order to detect and decode the cropped QR code from one image?

Steps to reproduce

import cv2 detector = cv2.wechat_qrcode_WeChatQRCode("./detect.prototxt", "./detect.caffemodel", "./sr.prototxt", "./sr.caffemodel") img=cv2.imread('./2dbarcode.jpeg') res, points = detector.detectAndDecode(img) print(res, points) img=cv2.imread('./cropped-barcode.jpg') res, points = detector.detectAndDecode(img) print(res, points)

Issue submission checklist
  • [ ] I report the issue, it's not a question
  • [x] I checked the problem with documentation, FAQ, open issues, answers.opencv.org, Stack Overflow, etc and have not found solution
  • [x] I updated to latest OpenCV version and the issue is still there
  • [x] There is reproducer code and related data files: videos, images, onnx, etc

cropped-barcode

2dbarcode

donalduk avatar Nov 11 '21 13:11 donalduk

The code with the three bullseyes at the corners is a QR code. The other code (with the black L on the left and bottom) is a data matrix code. It is not readable by QR code readers.

andrewwetzel23 avatar Aug 29 '22 17:08 andrewwetzel23