Hello, we are maintaining a QR code scanning App, which scans through the front camera and works fine. We show a preview to help guide the user to position the QR Code in front of the camera.
We do this by:
_session = [[AVRCaptureSession alloc] init];
_device = [self frontCamera];
_input = [AVCaptureDeviceInput deviceInputWithDevice:_device error:&error];
[_session addInput:_input];
_output = [[AVCaptureMetadataOutput alloc] init];
[_session addOutput:_output];
_prevLayer = [AVCaptureVideoPreviewLayer layerWithSession:_session];
_prevLayer.frame = (our desired placement on screen)
This puts a nice live video preview feed on the screen, and when the QRCode is detected it triggers an event.
Our client has asked us to 'zoom' the preview so that the live video preview feed is tighter around the code. I can *increase* the size of the preview by increasing the size of the _prevLayer.frame, but we don't want to take more screen real estate, what we really want is to only show, say, the middle quadrant of the preview. Same effect would be if I could increase the size of the preview, and then "crop" the preview back down to the original size, so you just see the zoomed center of the original view.
I'm not having much luck with this. Is there a good way to do this, any properties I can play with to achieve this effect?
Thanks very much.