我使用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];
谁能告诉我我遇到了什么问题? 非常感谢!
答案 0 :(得分: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];
答案 1 :(得分:4)
试试这个:
[filterView setInputRotation:kGPUImageFlipHorizonal atIndex:0];
答案 2 :(得分:0)
我认为您可以轻松更改最终图像:
UIImage *finalImage = //image from the camera
UIImage * flippedImage = [UIImage imageWithCGImage:finalImage.CGImage scale:finalImage.scale orientation:UIImageOrientationLeftMirrored];
答案 3 :(得分:0)
刚设置:
stillCamera.horizontallyMirrorFrontFacingCamera = YES;
将解决此问题。