Skip to content

QRCodeEncoder does not work with more than 135 characters and auto detected version #27183

@fdegaulejac

Description

@fdegaulejac

System Information

Using both the c++ lib and opencv-python:
Issue not present in 4.8
Issue start with version: 4.9
Issue still present in 4.11

Detailed description

QRCodeEncoder does not work with more than 135 characters and auto detected version, no error is logged but the generated QR code is not detected by any QR scanner.

Steps to reproduce

data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
qr_encoder = cv2.QRCodeEncoder.create()
qr_code = qr_encoder.encode(data)

=> the generated QR code is not detected by any QR scanner

Workaround, add the version manually:

data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
params = cv2.QRCodeEncoder.Params()
params.version = 7
qr_encoder = cv2.QRCodeEncoder.create(params)
qr_code = qr_encoder.encode(data)

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • 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)

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions