Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capture barcode from front camera iOS

In my app I've to capture a barcode with AVCaptureVideoPreviewLayer and AVCaptureSession, when I use the rear camera all works perfectly and very fast, but when I try to read the same code from the front camera it doesn't work. I tried to mirror the AVCaptureVideoPreviewLayer with the following code videoPreviewLayer.affineTransform = CGAffineTransformMakeScale(-1, 1);, it mirror the image but the device is still unable to detect barcode. There's a way to detect a barcode from the front camera?

like image 449
lucgian841 Avatar asked Mar 01 '17 09:03

lucgian841


People also ask

Can iPhone front camera scan QR Codes?

Use the camera to read a QR code Open Camera, then position iPhone so that the code appears on the screen. Tap the notification that appears on the screen to go to the relevant website or app.

Can I scan QR code with front camera?

Several websites allow you to scan QR Codes through your webcam or front-facing camera. Hold up the QR Code in front of your device and the associated link will appear on the screen.

How do you scan a code with a front camera?

Tap the color lens icon in Google Assistant, or open the Google Lens app. Select the Search mode. Center the QR code that you want to scan on the screen and hold your phone steady for a couple of seconds. Tap the notification that pops up to open the link.

Can you scan a barcode from a screenshot on iPhone?

To scan QR codes in images, pictures, or screenshots on your iPhone, you need to use a third-party QR code scanner. There are countless apps like this on the App Store—many of which charge a hefty fee if you accidentally sign up for a premium subscription.


1 Answers

There's a way to detect a barcode from the front camera?

Yes, you can use a third party library to do that. For example ZXingObjC.

You will need to setup your ZXCapture object like this:

  ZXCapture *capture = [[ZXCapture alloc] init];
  capture.camera = self.capture.front;
  capture.focusMode = AVCaptureFocusModeLocked;
like image 200
Enrique Bermúdez Avatar answered Sep 23 '22 01:09

Enrique Bermúdez