GPUImage:混合两个图像 [英] GPUImage: blending two images
问题描述
我正在使用GPUImage框架(一些旧版本)来混合两个图像(将边框叠加添加到某个图像)。
我更新到最新的框架版本后,应用这样的混合后,我得到一个空的黑色图像。
I was using GPUImage framework (some old version) to blend two images (adding border overlay to a certain image). After I have updated to latest framework version, after applying such a blend, I get an empty black image.
我正在使用下一个方法:
I'm using next method:
- (void)addBorder {
if (currentBorder != kBorderInitialValue) {
GPUImageAlphaBlendFilter *blendFilter = [[GPUImageAlphaBlendFilter alloc] init];
GPUImagePicture *imageToProcess = [[GPUImagePicture alloc] initWithImage:self.imageToWorkWithView.image];
GPUImagePicture *border = [[GPUImagePicture alloc] initWithImage:self.imageBorder];
blendFilter.mix = 1.0f;
[imageToProcess addTarget:blendFilter];
[border addTarget:blendFilter];
[imageToProcess processImage];
self.imageToWorkWithView.image = [blendFilter imageFromCurrentlyProcessedOutput];
[blendFilter release];
[imageToProcess release];
[border release];
}
}
有什么问题?
推荐答案
您忘记处理边框图像。在 [imageToProcess processImage]
之后,添加以下行:
You're forgetting to process the border image. After [imageToProcess processImage]
, add the line:
[border processImage];
如果要将两个图像输入到混合中,则必须使用 - 在将它们添加到混合滤镜后,两者都有processImage
。我改变了混合滤镜的工作方式以修复一些错误,这就是你现在需要做的事情。
For a two images being input into a blend, you have to use -processImage
on both after they have been added to the blend filter. I changed the way that the blend filter works in order to fix some bugs, and this is how you need to do things now.
这篇关于GPUImage:混合两个图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!