Post

Replies

Boosts

Views

Activity

Reply to iPhone 14 Pro camera broke most ID verification frameworks
Here is some Objective C code that will implement what is presented by Apple at https://developer.apple.com/videos/play/wwdc2021/10047/?time=133 See also their BarCode example app here: https://developer.apple.com/documentation/avfoundation/capture_setup/avcambarcode_detecting_barcodes_and_faces?language=objc if (@available(iOS 15.0, *)) { AVCaptureDevice *videoDevice = self.videoCamera.inputCamera; // you'll replace this RHS expression with your video device int deviceFieldOfView = videoDevice.activeFormat.videoFieldOfView; float previewFillPercentage = 0.8; // 0..1, target object will fill 80% of preview window float minimumTargetObjectSize = 15.0 * 10.0; // min width of target object in mm (here, it's 15 cm) float radians = DegreesToRadians(deviceFieldOfView); float filledTargetObjectSize = minimumTargetObjectSize / previewFillPercentage; int minimumSubjectDistance = filledTargetObjectSize / tan(radians / 2.0); // Field of View equation NSInteger deviceMinimumFocusDistance = videoDevice.minimumFocusDistance; if (minimumSubjectDistance < deviceMinimumFocusDistance) { float zoomFactor = deviceMinimumFocusDistance / minimumSubjectDistance; [videoDevice lockForConfiguration: NULL]; [videoDevice setVideoZoomFactor:zoomFactor]; [videoDevice unlockForConfiguration]; } } else { // No API to help here, but these phones won't have macro lenses }
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’23