2

我使用 gpuimage 来构建一个摄影应用程序。但是当我选择前置摄像头的时候,后面出现的摄像头图片是反转的(左,右)这里的代码:

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

谁能告诉我我遇到了什么问题?非常感谢!

4

4 回答 4

5

尝试这个...

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];
于 2013-06-26T09:30:58.487 回答
4

尝试这个 :

[filterView setInputRotation:kGPUImageFlipHorizonal atIndex:0];
于 2013-06-28T07:34:33.077 回答
0

我认为您可以轻松更改最终图像:

UIImage *finalImage = //image from the camera

UIImage * flippedImage = [UIImage imageWithCGImage:finalImage.CGImage scale:finalImage.scale orientation:UIImageOrientationLeftMirrored];
于 2013-06-26T08:19:37.613 回答
0

只需设置:

stillCamera.horizontallyMirrorFrontFacingCamera = YES;

将解决这个问题。

于 2017-08-25T08:23:15.300 回答