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

Region of interest feature does not work for non-square aspect ratios(!) #179

Open
xc212 opened this issue Oct 16, 2019 · 4 comments
Open

Comments

@xc212
Copy link

xc212 commented Oct 16, 2019

Expected behavior:

  • QR code should scan if it is framed by the rect of interest with a small margin

Found behavior:

  • QR code does not scan unless it is significantly smaller than the rect of interest

Steps to reproduce:

  • Modify example so that the preview is full screen. (To do this I deleted all constraints on it and used the autoresizing mask to cover all of the superview.)
  • Modify the region of interest so that it appears approximately square even though the view is non-square
  • Start scanning a QR code from up close, then zoom out
  • It will be a while before the region detects the QR code - the QR code is only detected at scales much smaller than the region displayed (see image)

IMG_3230

^ this is the maximum scale I could get the QR code to scan with, starting from a close zoom

Tested on iOS 13 with iPhone X

@steventnorris-40AU
Copy link

Has there been a solution for this? I'm experiencing this as well. If I pull the phone really far away so the QR code is teeny tiny, it scans. Anything other than that will not work. My scale ends up being much smaller than what @xc212 experienced, using an iPhoneX.

@steventnorris-40AU
Copy link

Also, @xc212 if you don't use a rectOfInterest, it should scan fine at any size, which is my workaround for now. It seems the interest rectangle is done as a percentage of the screen, so getting a square might not be possible anyhow. This seems to be an issue with certain phone resolutions as well, so it's possible the drawn interest area and the actual area of the image being checked differ.

@ddaddy
Copy link

ddaddy commented Apr 4, 2020

I'm having this same problem. If I don't use rectOfInterest then a qrcode will scan at any size. If I add a rectOfInterest the qrcode needs to be significantly smaller than the rectOfInterest for it to scan.

@mirekkukla
Copy link

The underlying seems to be that the rectOfInterest dimensions, when it comes to drawing the visual helper lines, assume your phone is in portrait orientation. Behind the scenes, though, when it comes to actually detecting the bar code, the given rectOfInterest dimensions are read as if your phone was in landscape orientation.

This is why a square area of interest works: the 'displayed' rectangle matches the detection region.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants