GPUImageLookupFilter没有为以下LUT图像提供所需的结果

问题描述 投票:0回答:1

我有这个LUT png,当在我的图像上应用这个LUT时,没有给出正确的结果。我的LUT是否有不同的格式,或者我没有正确应用过滤器。 enter image description here

UIImage *lutimage = [UIImage imageNamed:@"lut.png"];
    GPUImagePicture *lookupImageSource = [[GPUImagePicture alloc] initWithImage:lutimage];
    GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:imported_image];
    GPUImageLookupFilter *lookupFilter = [[GPUImageLookupFilter alloc] init];
    lookupFilter.intensity = 1.0;
    [lookupFilter setInputRotation:kGPUImageRotateRight atIndex:1];
    [stillImageSource addTarget:lookupFilter];
    [lookupImageSource addTarget:lookupFilter];
    [lookupFilter useNextFrameForImageCapture];
    [stillImageSource processImage];
    [lookupImageSource processImage];
    imgview_main.image = [lookupFilter imageFromCurrentFramebuffer];
    [[GPUImageContext sharedFramebufferCache] purgeAllUnassignedFramebuffers];

结果是:enter image description here

但结果应该是这样的:enter image description here

ios objective-c gpuimage lookup-tables gpuimagestillcamera
1个回答
0
投票

HALD查找表是一种将一种输入颜色转换为一种输出颜色的方法。 HALD图像中的位置与像素颜色有关,而不是它在图像上的位置。

你所做的就是在颜色查找表中添加一个晕影,所以在LUT的右下角,你已经做得那么暗了。将此LUT应用于图像时会发生的情况是图像中的明亮像素变得更暗 - 就像您告诉它的那样。 LUT中的位置与图像像素位置无关,只与RGB强度有关。

你需要某种叠加滤波器(也许使用乘法),它在叠加层中的位置对应于你想要改变的图像中的位置。

TL; DR:当你应该使用一些代码来添加图像叠加/掩码时,你正在使用一些颜色查找翻译代码。

© www.soinside.com 2019 - 2024. All rights reserved.