How to use GPUImageLookupFilter without GPUImageFilterGroup?

╄→尐↘猪︶ㄣ 提交于 2019-12-04 13:21:18

Thanks to Brad Larson for answering:

For one thing, you're adding both of your images to texture location 1, so one is overriding the other. You need to add your input image to texture location 0 and lookup pattern to location 1, I believe.

This is how I personally use it:

- (UIImage *)filterImage:(GPUImagePicture *)originalImageSource withLUTNamed:(NSString *)lutName
{
    GPUImagePicture *lookupImageSource = [[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:lutName]];
    GPUImageLookupFilter *lookupFilter = [[GPUImageLookupFilter alloc] init];

    [originalImageSource addTarget:lookupFilter];
    [lookupImageSource addTarget:lookupFilter];

    [lookupFilter useNextFrameForImageCapture];
    [originalImageSource processImage];
    [lookupImageSource processImage];

    return [lookupFilter imageFromCurrentFramebufferWithOrientation:UIImageOrientationUp];
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!