Skip to content

Conversation

@karolbielski
Copy link
Contributor

@karolbielski karolbielski commented Feb 10, 2024

Due to different minimum focus distance built in modern cameras it is hard to focus on small barcodes. To improve the fucus it is needed to apply appropriate zoom factor.

Based on sample code from Apple AVCamBarcode: Detecting barcodes and faces AVCaptureDevice#setRecommendedZoomFactor(forMinimumCodeSize:) method was added to set required zoom factor for desired code size.

Additionaly, AVCaptureDevice.zoomedCameraForQRCode(withMinimumCodeSize:) method was added to choose single wide angle camera and apply zoom factor at once. From my experiments, the focus is a lot better on devices with dual or tripple cameras while scanning codes from short distance.

More information can be found in WWDC 2021 session What’s new in camera capture.

Due to usage of Apple sample code I included text of Apple's license.

Fixes #89
Fixes #113
Fixes #124

@karolbielski karolbielski changed the title Focus improvements on dual and tripple cameras [#89] [#113] [#124] Focus improvements on dual and tripple cameras Feb 10, 2024
@karolbielski karolbielski changed the title [#89] [#113] [#124] Focus improvements on dual and tripple cameras [#89, #113, #124] Focus improvements on dual and tripple cameras Feb 12, 2024
@karolbielski karolbielski changed the title [#89, #113, #124] Focus improvements on dual and tripple cameras [#89] [#113] [#124] Focus improvements on dual and tripple cameras Feb 12, 2024
@nathanfallet nathanfallet merged commit 7da6b1e into twostraws:main Feb 23, 2024
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

Successfully merging this pull request may close these issues.

QR Code Rate of recognition AVCamBarcode vs. CodeScanner Camera not focusing iPhone 14 Focus Distance

2 participants