从前置摄像头捕捉数据时,我总是得到镜像图像,我怎样才能得到我在预览窗口中看到的图像。我已将 videoMirrored
设置为 TRUE
。以下是代码片段:
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
更改为 True/False
也不会改变任何内容
(isVideoMirroringSupported
返回成功)
最佳答案
使用以下代码翻转镜像。
UIImage * flippedImage = [UIImage imageWithCGImage:picture.CGImage scale:picture.scale orientation:UIImageOrientationLeftMirrored];
关于iphone - 从前置摄像头 iOS 5.0 捕获时总是看到镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9227450/