gpt4 book ai didi

ios - 在电影文件上使用 GPUImageLookupFilter 会产生黑屏

转载 作者:可可西里 更新时间:2023-11-01 05:36:10 28 4
gpt4 key购买 nike

我正在将我的代码从静止图像应用程序转移到生成电影文件的应用程序。但是,以下代码存在一个问题,其中最终输出是使用 GPUImageLookupFilter 过滤器的黑色电影屏幕。任何人都可以发现我做错了什么或我可能错过了什么。

Header File Sample
GPUImagePicture *lookupImageSource;
GPUImageOutput<GPUImageInput> *filter;
GPUImageMovie *movieFile;
GPUImageMovieWriter *movieWriter;
@property(nonatomic,strong) GPUImagePicture *lookupImageSource;



Main File
filter = [[GPUImageFilterGroup alloc] init];

self.lookupImageSource = [[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:@"ExtremeVintage1.png"]];

GPUImageLookupFilter * filterLookup = [[GPUImageLookupFilter alloc] init];

[self.lookupImageSource addTarget:filterLookup];

[self.lookupImageSource processImage];

[(GPUImageFilterGroup *)filter addFilter:filterLookup];



[(GPUImageFilterGroup *)filter setInitialFilters:[NSArray arrayWithObject:filterLookup]];
[(GPUImageFilterGroup *)filter setTerminalFilter:filterLookup];


[movieFile addTarget:filter];

谢谢

**** 更新 *****

新代码

self.lookupImageSource = [[GPUImagePicture alloc] initWithImage:[UIImage    imageNamed:@"ExtremeVintage1.png"]];
[self.lookupImageSource processImage];

filter = [[GPUImageLookupFilter alloc] init];
[lookupImageSource addTarget:filter];

[movieFile addTarget:filter];

enter image description here

最佳答案

这是一个支持 ARC 的项目吗?如果是这样,那么在您设置上述方法之后,您并没有坚持对 lookupImageSource GPUImagePicture 实例的强引用。一旦退出该方法,提供查找的 GPUImagePicture 将被释放,结果您将丢失查找纹理。

尝试使 lookupImageSource 成为您的类的一个强实例变量,以便它在上面的设置代码之外仍然存在。

关于ios - 在电影文件上使用 GPUImageLookupFilter 会产生黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18080011/

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