我正在尝试使用以下代码设置 CIAdditionCompositing 过滤器:
CIImage *imageOne = [CIImage imageWithCGImage:[UIImage imageNamed:@"picOne"].CGImage];
CIImage *imageTwo = [CIImage imageWithCGImage:[UIImage imageNamed:@"picTwo"].CGImage];
filter = [CIFilter filterWithName:@"CIAdditionCompositing"];
[filter setDefaults];
[filter setValue:imageOne forKey:kCIInputImageKey];
[filter setValue:imageTwo forKey:kCIInputBackgroundImageKey];
CIImage *imageResult = [filter outputImage];
CGImageRef imageRef = [context createCGImage:imageResult fromRect:imageResult.extent];
_imageView.image = [UIImage imageWithCGImage:imageRef];
并看到以下错误:
由于未捕获的异常“NSUnknownKeyException”而终止应用程序,原因:“[<__NSCFConstantString 0x2e2d60> setValue:forUndefinedKey:]:此类与键 inputImage 的键值编码不兼容。”
在线上
[filter setValue:imageOne forKey:kCIInputImageKey];
我在这个核心图像过滤器的设置中做错了什么?