与GPUImageMaskFilter一起使用时,为什么我的蒙版缩放?

时间:2014-07-16 19:00:20

标签: ios gpuimage

我有一个视频摄像头输入屏蔽很好,但我的面具没有按预期显示。我有两个版本根据不同的外形尺寸。在iPhone 5上进行测试,掩模图像看起来像这样(这里显示的常规尺寸,有一个只是缩放的@ 2x版本):

enter image description here

但是我的预览看起来像这样:

enter image description here

了解如何缩放和更改蒙版?为什么会这样?

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

1 个答案:

答案 0 :(得分:0)

预览为横向时,蒙版是纵向。面具不会旋转。