GPUImageLookupFilter 不工作
GPUImageLookupFilter not working
我很难从自定义查找表中找到 GPUImageLookFilter
静止图像的真实世界示例用法。
根据我在互联网上收集的资料,我发现了这个建议:
// The original image that should receive the filter
GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:self.image];
// The image containing the lookup table (LUT) like https://github.com/BradLarson/GPUImage/blob/master/framework/Resources/lookup_amatorka.png
GPUImagePicture *lookupImageSource = [[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:@"LUT1.png"]];
// From now on I don't really understand what's going on
GPUImageLookupFilter *lookupFilter = [[GPUImageLookupFilter alloc] init];
[stillImageSource addTarget:lookupFilter];
[lookupImageSource addTarget:lookupFilter];
[stillImageSource useNextFrameForImageCapture];
[stillImageSource processImage];
[lookupImageSource useNextFrameForImageCapture];
[lookupImageSource processImage];
// This is always nil
UIImage *filteredimage = [lookupFilter imageFromCurrentFramebuffer];
因此,如果有人可以编写一个完整的示例,我将不胜感激,它使用了最新版本的 GPUImage 框架(撰写本文时为 0.1.6)and/or 解释一下它应该 是如何工作的。
-useNextFrameForImageCapture
只能在您要从中提取图像的目标过滤器上调用,没有别的。在上面,你是在你的输入上调用它,而不是你的输出。
您需要将其修改为如下所示:
stillImageSource addTarget:lookupFilter];
[lookupImageSource addTarget:lookupFilter];
[lookupFilter useNextFrameForImageCapture];
[stillImageSource processImage];
[lookupImageSource processImage];
lookupFilter
是您从中提取 UIImage 的对象,因此需要告知您将从中捕获。该处理是通过调用 processImage
来上传您的两个 GPUImagePicture 源来启动的,因此 -useNextFrameForImageCapture
调用需要在它们之前进行。
我很难从自定义查找表中找到 GPUImageLookFilter
静止图像的真实世界示例用法。
根据我在互联网上收集的资料,我发现了这个建议:
// The original image that should receive the filter
GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:self.image];
// The image containing the lookup table (LUT) like https://github.com/BradLarson/GPUImage/blob/master/framework/Resources/lookup_amatorka.png
GPUImagePicture *lookupImageSource = [[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:@"LUT1.png"]];
// From now on I don't really understand what's going on
GPUImageLookupFilter *lookupFilter = [[GPUImageLookupFilter alloc] init];
[stillImageSource addTarget:lookupFilter];
[lookupImageSource addTarget:lookupFilter];
[stillImageSource useNextFrameForImageCapture];
[stillImageSource processImage];
[lookupImageSource useNextFrameForImageCapture];
[lookupImageSource processImage];
// This is always nil
UIImage *filteredimage = [lookupFilter imageFromCurrentFramebuffer];
因此,如果有人可以编写一个完整的示例,我将不胜感激,它使用了最新版本的 GPUImage 框架(撰写本文时为 0.1.6)and/or 解释一下它应该 是如何工作的。
-useNextFrameForImageCapture
只能在您要从中提取图像的目标过滤器上调用,没有别的。在上面,你是在你的输入上调用它,而不是你的输出。
您需要将其修改为如下所示:
stillImageSource addTarget:lookupFilter];
[lookupImageSource addTarget:lookupFilter];
[lookupFilter useNextFrameForImageCapture];
[stillImageSource processImage];
[lookupImageSource processImage];
lookupFilter
是您从中提取 UIImage 的对象,因此需要告知您将从中捕获。该处理是通过调用 processImage
来上传您的两个 GPUImagePicture 源来启动的,因此 -useNextFrameForImageCapture
调用需要在它们之前进行。