gpt4 book ai didi

ios - 使用 GPUImage 库的多个过滤器

转载 作者:行者123 更新时间:2023-11-28 18:21:59 25 4
gpt4 key购买 nike

我正在尝试对一张图片应用 3 个滤镜。

一个 rgbFilter 的值是常量,一个亮度过滤器和一个饱和度过滤器,两者都应该能够被修改并且图像应该更新。

我听从了建议here .

我已经使用 IB 设置了一个 UIView,并将其类设置为 GPUImageView。由于某种原因,图像没有显示。

我的步骤如下:

self.gpuImagePicture = [[GPUImagePicture alloc] initWithImage:image];
[self.gpuImagePicture addTarget:self.brightnessFilter];
[self.brightnessFilter addTarget:self.contrastFilter];
[self.contrastFilter addTarget:self.imageView];

然后我调用它来设置 rgb 滤镜上的常量值

[self setRGBFilterValues]

我在此之前设置了我的过滤器:

- (void) setupFilters
{
self.brightnessFilter = [[GPUImageBrightnessFilter alloc] init];
self.contrastFilter = [[GPUImageContrastFilter alloc] init];
self.rgbFilter = [[GPUImageRGBFilter alloc] init];
}

我是不是漏掉了一步,或者为什么图片什么也没显示?

最佳答案

您错过了一步。您需要在 GPUImagePicture 实例上调用 -processImage 以使其通过过滤器链传播。

您还需要在更改过滤器链中的值并希望更新最终输出时随时调用它。

关于ios - 使用 GPUImage 库的多个过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18688101/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com