简体   繁体   English

反向facetime摄像头被倒置

[英]Reverse facetime camera is inverted

I use gpuimage to build a photography app.我使用 gpuimage 来构建一个摄影应用程序。 But when I select the front camera, the camera picture appears on the back is reversed (left, right) Code here:但是当我选择前置摄像头时,后面出现的摄像头画面是颠倒的(左,右)代码在这里:

 stillCamera = [[GPUImageStillCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack]; 
stillCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
filter = [[GPUImageRGBFilter alloc] init];

[stillCamera addTarget:filter];
GPUImageView *filterView = (GPUImageView *)self.view;
[filter addTarget:filterView];

[stillCamera startCameraCapture];

Who can tell me what I'm having problems?谁能告诉我我遇到了什么问题? Thank very much!非常感谢!

try this...尝试这个...

stillCamera = [[GPUImageStillCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack]; 
stillCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
stillCamera.horizontallyMirrorFrontFacingCamera = NO;
stillCamera.horizontallyMirrorRearFacingCamera = NO;

filter = [[GPUImageRGBFilter alloc] init];

[stillCamera addTarget:filter];
GPUImageView *filterView = (GPUImageView *)self.view;
[filter addTarget:filterView];

[stillCamera startCameraCapture];

尝试这个 :

[filterView setInputRotation:kGPUImageFlipHorizonal atIndex:0];

I think that you can easily change the final image :我认为您可以轻松更改最终图像:

UIImage *finalImage = //image from the camera

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

Just set:只需设置:

stillCamera.horizontallyMirrorFrontFacingCamera = YES;

will fix this problem.将解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM