[英]Can't save the image after using GPUImage filter
Some of my code at follow: 我的一些代码如下:
GPUImagePicture* staticPicture = [[GPUImagePicture alloc] initWithImage:[info objectForKey:UIImagePickerControllerOriginalImage] smoothlyScaleOutput:YES];
GPUImageSaturationFilter * filter = [[GPUImageSaturationFilter alloc] init];
[filter setSaturation:0.2];
[filter addTarget:((GPUImageView *)gpuImageView)];
[staticPicture addTarget:filter];
[staticPicture processImage];
_saveImage = [filter imageFromCurrentFramebuffer];
[self.testImageView setImage:_saveImage];
I want use imageFromCurrentFramebuffer to get the image with filter, but i get always nil.Use [self.testImageView setImage:_saveImage] always get blank. 我想使用imageFromCurrentFramebuffer来获取带有过滤器的图像,但是我总是为零。使用[self.testImageView setImage:_saveImage]总是空白。
Do i get the image in a wrong way?Any sugesst is welcome. 我是否以错误的方式获得图像?欢迎任何sugesst。 A lot of thanks.
非常感谢。
You need to call 你需要打电话
[filter useNextFrameForImageCapture];
on a line right before you call 在您致电之前在线
[staticPicture processImage];
Otherwise, the filter won't know to hang on to its processed framebuffer long enough for you to capture your image. 否则,过滤器将不知道将其挂在经过处理的帧缓冲区上足够长的时间,以至于您无法捕获图像。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.