0
我有一個攝像頭輸入掩碼就好了,但我的面具沒有按預期顯示。我有兩個版本根據不同的外形尺寸大小。在iPhone 5測試,屏蔽圖像看起來是這樣的(這裏顯示常規尺寸,也就是剛邁上了一個@ 2X版本):爲什麼在使用GPUImageMaskFilter時我的遮罩縮放?
但是我的預覽看起來是這樣的:
看看面罩如何縮放和改變?這是爲什麼發生?
_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];