我对最新的重构有问题。每次我试图从过滤器中获取经过处理的UIImage时,它都是零。我用过
useNextFrameForImageCapture
但它仍然不起作用。
下面是我的代码片段:
self.imageView = [[GPUImageView alloc] initWithFrame:CGRectMake(0,
0,
self.view.frame.size.width,
self.view.frame.size.height)];
staticPicture = [[GPUImagePicture alloc] initWithImage:img
smoothlyScaleOutput:YES];
filter = [[GPUImageToneCurveFilter alloc] initWithACV:@"cool"];
[staticPicture addTarget:filter];
[filter addTarget:self.imageView];
GPUImageRotationMode imageViewRotationMode = kGPUImageNoRotation;
switch (staticPictureOriginalOrientation) {
case UIImageOrientationLeft:
imageViewRotationMode = kGPUImageRotateLeft;
break;
case UIImageOrientationRight:
imageViewRotationMode = kGPUImageRotateRight;
break;
case UIImageOrientationDown:
imageViewRotationMode = kGPUImageRotate180;
break;
default:
imageViewRotationMode = kGPUImageNoRotation;
break;
}
// seems like atIndex is ignored by GPUImageView...
[self.imageView setInputRotation:imageViewRotationMode atIndex:0];
[staticPicture useNextFrameForImageCapture];
[staticPicture processImage];
UIImage *processedImage = [filter imageFromCurrentFramebufferWithOrientation:staticPictureOriginalOrientation];
processedImage始终为空。非常感谢您的帮助!