VideoCore-Inactive icon indicating copy to clipboard operation
VideoCore-Inactive copied to clipboard

On front Camera when the phone rotate to left or right, the picture is upsidedown

Open UmerAfzal1 opened this issue 9 years ago • 2 comments

when the on front camera and phone rotate to left or right , the picture is upside down, how to make the orientation of the picture just like the system camera APP ? that working fine then rotate phone up or down.

UmerAfzal1 avatar May 10 '16 09:05 UmerAfzal1

On front Camera when the phone rotate to left or right, the picture is upsidedown is due to mirror image,if we rectify the mirror image then the upside down problem will be solved. Below code will be useful to solve this problem.Add the below code in camera.m class with method named:CameraSource::reorientCamera() av.videoMirrored = ([device position] == AVCaptureDevicePositionFront);

vishalraj001 avatar May 20 '16 10:05 vishalraj001

CameraSource::reorientCamera() //...... for (AVCaptureVideoDataOutput* output in session.outputs) { if ([output isKindOfClass:[AVCaptureMetadataOutput class]]) { continue; } for (AVCaptureConnection * av in output.connections) { switch (orientation) { //..... } // make the front camera mirrored AVCaptureInput* currentCameraInput = [session.inputs objectAtIndex:0]; if(((AVCaptureDeviceInput*)currentCameraInput).device.position == AVCaptureDevicePositionFront){ [av setVideoMirrored:YES]; } }

dourgulf avatar May 21 '16 07:05 dourgulf