ios - 如果我插入此函数 -imageFromCurrentFramebufferWithOrientation - (GPUImageLookupFilter),我会收到错误消息

标签 ios cocoa-touch gpuimage

我在实现 GPUImageLookupFilter 时遇到问题。 我在这行代码中遇到错误:UIImage *adjustedImage = [lookupFilter imageFromCurrentFramebufferWithOrientation];

它说(错误): “'GPUImageLookupFilter' 的可见@interface 声明选择器'imageFromCurrentFramebufferWithOrientation'”

这是我的代码:

- (IBAction)filter1:(id)sender;
{
GPUImageLookupFilter *lookup = [[GPUImageLookupFilter alloc] init];
GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:imgView];

GPUImagePicture *lookupImageSource = [[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:@"lookup_Invert.png"]];
GPUImageLookupFilter *lookupFilter = [[GPUImageLookupFilter alloc] init];
[stillImageSource addTarget:lookupFilter];
[lookupImageSource addTarget:lookupFilter];


[stillImageSource processImage];
[lookupFilter useNextFrameForImageCapture];
[lookupImageSource processImage];

UIImage *adjustedImage = [lookupFilter imageFromCurrentFramebufferWithOrientation];
}

最佳答案

首先,请通读我在 the very first page of the project 上写的文档.在进一步学习之前阅读它可以避免很多麻烦。盲目地从 Internet 复制代码并不是构建应用程序的好方法。

正如我在 my answer 中解释的那样我在你之前的问题中指出,框架处理帧缓冲区的方式已经改变,所以你发现的很多示例代码现在已经过时了。要使用查找过滤器处理静止图像,您需要在触发上面的 -processImage 之前将 -useNextFrameForImageCapture 发送到您的查找过滤器。 -processImage 导致初始图像通过链接的过滤器操作级联,并且您需要告诉您的最终过滤器您将在触发该处理之前从中提取图像。

完成后,您可以使用 -imageFromCurrentFramebuffer-imageFromCurrentFramebufferWithOrientation: 提取图像(注意后者中的参数,因为上面的代码不会编译)。

再次,请阅读我在 GPUImage 的 GitHub 存储库首页上链接到的资源以及我之前的回答,然后再继续。您真的应该了解它是如何运作的,这就是为什么我不会在这里向您灌输您需要的代码。

关于ios - 如果我插入此函数 -imageFromCurrentFramebufferWithOrientation - (GPUImageLookupFilter),我会收到错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23173213/

相关文章:

objective-c - NSFetchedResultsController 不显示来自后台线程的更改

ios - 应用程序在后台ios时如何录制视频

ios - Objective-c 如何向现有视频(如 Instagram 应用程序)添加过滤器?

ios - "libRestKit.a, file was built for archive which is not the architecture being linked (armv7)"

ios - 将选定的单元格textLabel文本存储在数组中

iphone - 如何更改状态栏的颜色

cocoa-touch - 平均作为获取的属性?

ios - 使用数据将 PFFile 转换为 UIImage 并附加到数组

ios - 使用 Parse 注册后,performSegueWithIdentifier 不起作用

ios - swift 2 : Local Notification at Bottom of Screen instead of Middle