Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Always seeing Mirror image while capturing from Front Camera iOS 5.0

While capturing data from Front camera I am always getting Mirror image, how can I get what I am seeing in my preview window. I have set videoMirrored to be TRUE. Following is the code snippet:

AVCaptureConnection *lConnection = nil;

  for ( AVCaptureConnection *connection in [lHandle->m_output connections]) {
     for ( AVCaptureInputPort *port in [connection inputPorts] ) {
         if ( [[port mediaType] isEqual:AVMediaTypeVideo] ) {
             lConnection = connection;
             break;
         }
     }
 }
if ([lConnection isVideoOrientationSupported])
    [lConnection setVideoOrientation:AVCaptureVideoOrientationPortrait];
if ([lConnection isVideoMirroringSupported])
    [lConnection setVideoMirrored:TRUE];

Changing setVideoMirrored to True/False also doesn't change anything (isVideoMirroringSupported returns Success)

like image 957
Rajat Kothari Avatar asked Feb 03 '23 08:02

Rajat Kothari


1 Answers

Flip the mirrored image with the following code.

UIImage * flippedImage = [UIImage imageWithCGImage:picture.CGImage scale:picture.scale orientation:UIImageOrientationLeftMirrored];
like image 121
Mohammed Afsul Avatar answered Feb 13 '23 07:02

Mohammed Afsul