我有一个视频摄像头输入屏蔽很好,但我的面具没有按预期显示。我有两个版本根据不同的外形尺寸。在iPhone 5上进行测试,掩模图像看起来像这样(这里显示的常规尺寸,有一个只是缩放的@ 2x版本):
但是我的预览看起来像这样:
了解如何缩放和更改蒙版?为什么会这样?
_camera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPresetHigh cameraPosition:AVCaptureDevicePositionBack];
_camera.outputImageOrientation = UIInterfaceOrientationLandscapeRight;
GPUImageMaskFilter *maskFilter = [[GPUImageMaskFilter alloc] init];
[maskFilter setBackgroundColorRed:0.7 green:0.7 blue:0.7 alpha:1.0];
[_camera addTarget:maskFilter];
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenHeight = screenRect.size.height;
NSString *imageName = (screenHeight == 568 ? @"TallCheckMask" : @"ShortCheckMask");
UIImage *inputImage = [UIImage imageNamed:imageName];
sourcePicture = [[GPUImagePicture alloc] initWithImage:inputImage smoothlyScaleOutput:YES];
[sourcePicture processImage];
[sourcePicture addTarget:maskFilter];
[maskFilter addTarget:_backgroundImageView];
[_camera startCameraCapture];
答案 0 :(得分:0)
预览为横向时,蒙版是纵向。面具不会旋转。