从Front Camera iOS 5.0捕获时始终看到镜像 [英] Always seeing Mirror image while capturing from Front Camera iOS 5.0

查看:413
本文介绍了从Front Camera iOS 5.0捕获时始终看到镜像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从前置摄像头捕获数据时我总是得到镜像,如何在预览窗口中看到我所看到的内容。我已将 videoMirrored 设置为 TRUE 。以下是代码段:

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];

setVideoMirrored 更改为正确/错误也不会改变任何东西
isVideoMirroringSupported 返回成功)

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

推荐答案

使用以下代码翻转镜像图像。

Flip the mirrored image with the following code.

UIImage * flippedImage = [UIImage imageWithCGImage:picture.CGImage scale:picture.scale orientation:UIImageOrientationLeftMirrored];

这篇关于从Front Camera iOS 5.0捕获时始终看到镜像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆