Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

detectMulti() x86-64 and detectMulti() ARM64 work differently in QRCodeDetector in some cases (problem with resize) #22133

Closed
4 tasks done
AleksandrPanov opened this issue Jun 20, 2022 · 1 comment · Fixed by #22358 or opencv/opencv_extra#992
Assignees
Labels
bug category: imgproc category: objdetect platform: arm ARM boards related issues: RPi, NVIDIA TK/TX, etc
Milestone

Comments

@AleksandrPanov
Copy link
Contributor

AleksandrPanov commented Jun 20, 2022

QRCodeDetector.detectMulti() x86-64 and QRCodeDetector.detectMulti() ARM64 work differently in some cases

  • OpenCV => 4.6.0 Python
  • Operating System / Platform => x86/64 ubuntu 20.04 and jetson nano ARM64
Detailed description

script:

import cv2 as cv
def main():
    print(cv.__version__)
    image = cv.imread("image056.jpg", cv.IMREAD_IGNORE_ORIENTATION)
    detector = cv.QRCodeDetector()
    res = detector.detectAndDecodeMulti(image)
    print(res)

result x86/x64:

4.6.0
(False, (), None, ())

ARM64 detect and decode successfully:

corners: 7.21591736e+02, 2.26398071e+02, 1446., 592., 9.76341980e+02, 1.28422656e+03, 178., 807.
decoded_info: "http://www.bestekmall.com/"

image056.jpg:

image056

image from https://boofcv.org/notwiki/regression/fiducial/qrcodes_v3.zip

also some differently values in "detection/nominal/image001.jpg", "detection/nominal/image047.jpg", ...

Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc
@AleksandrPanov AleksandrPanov added bug category: objdetect platform: arm ARM boards related issues: RPi, NVIDIA TK/TX, etc labels Jun 20, 2022
@AleksandrPanov AleksandrPanov self-assigned this Jun 20, 2022
@AleksandrPanov
Copy link
Contributor Author

AleksandrPanov commented Aug 3, 2022

There is problem with resize()+INTER_LINEAR image. Resizing with a non-integer scale factor works differently on x86/arm.
cpp sample:
test.cpp..txt
bin_barcode

arm (raspberry pi 4, cortex A72, Raspberry Pi OS 64 bit) result:

res_arm

x86_64 (ryzen 2700x, Ubuntu 20.04) result:

res_x86_64

Check images diff with python script:

import cv2 as cv
import numpy as np
img = cv.imread("res_arm.png")
img1 = cv.imread("res_x86_64.png")
print(img[0,0:5])
print()
print(img1[0,0:5])
print()
print(np.max(img-img1))

Result:

[[255 255 255]
 [245 245 245]
 [153 153 153]
 [ 64  64  64]
 [  0   0   0]]

[[255 255 255]
 [246 246 246]
 [155 155 155]
 [ 64  64  64]
 [  0   0   0]]

255

QR problem in this line:
resize(bin_barcode, intermediate, new_size, 0, 0, INTER_LINEAR);

@AleksandrPanov AleksandrPanov changed the title detectMulti() x86-64 and detectMulti() ARM64 work differently in QRCodeDetector in some cases detectMulti() x86-64 and detectMulti() ARM64 work differently in QRCodeDetector in some cases (problem with resize) Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug category: imgproc category: objdetect platform: arm ARM boards related issues: RPi, NVIDIA TK/TX, etc
Projects
None yet
2 participants