iphone - CIHueAdjust核心图像滤镜设置

标签 iphone ios xcode core-image hue

尝试实现CIHueAdjust时出现错误。应用程序终止,并显示以下错误:-[CIImage doubleValue]:无法识别的选择器已发送到实例0xd6606d0

这是整个项目:owolf.net/uploads/StackOverflow/HueAdjustProject.zip

这是.m代码:

- (void)viewDidLoad
{
    context = [CIContext contextWithOptions:nil];
    hueFilter = [CIFilter filterWithName:@"CIHueAdjust"];
    inputCGImage = imageView.image.CGImage;
    [super viewDidLoad];
}

- (IBAction)hueSliderValueChanged:(id)sender {
    [hueFilter setValue:[NSNumber numberWithFloat:hueSlider.value] forKey: @"inputAngle"];
    [self filterImage];
}

-(void)filterImage {
    adjustedImage = [CIImage imageWithCGImage:inputCGImage];
    [hueFilter setValue:adjustedImage forKey:@"inputAngle"];
    adjustedImage = [hueFilter outputImage];
    CGImageRef cgimg = [context createCGImage:adjustedImage fromRect:[adjustedImage extent]];
    adjustedUIImage = [UIImage imageWithCGImage:cgimg];
    CGImageRelease(cgimg);
    [imageView setImage:adjustedUIImage]; 
}

错误日志:

2012-08-16 17:14:02.062 HueAdjustProject [3333:707]-[CIImage doubleValue]:无法识别的选择器已发送到实例0xd6606d0
2012-08-16 17:14:02.065 HueAdjustProject [3333:707] *由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[CIImage doubleValue]:无法识别的选择器已发送至实例0xd6606d0'
*
首先抛出调用堆栈:
(0x3544088f 0x377e7259 0x35443a9b 0x35442915 0x3539d650 0x36b09a3f 0xed0c5 0xed017 0x3539a3fd 0x32e8fe07 0x32e8fdc3 0x32e8fda1 0x32e8fb11 0x33085d07 0x32e8f6a5 0x32e8e8a1 0x32e8e319 0x32e74695 0x32e73f3b 0x3703322b 0x35414523 0x354144c5 0x35413313 0x353964a5 0x3539636d 0x37032439 0x32ea2cd5 0xecb17 0xecabc)
终止称为引发异常

最佳答案

[hueFilter setValue:adjustedImage forKey:@"inputAngle"];

应该
[hueFilter setValue:adjustedImage forKey:@"inputImage"];

关于iphone - CIHueAdjust核心图像滤镜设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11985150/

相关文章:

iOS - 存档的 IPA 大小与应用商店报告的大小不匹配

objective-c - 在 View 中循环播放视频

objective-c - 应用程序提交 iOS 的 Bundle ID

具有正面或负面属性的 iOS UIButton

ios - 使用弱引用时是否可以实现 NSFastEnumeration?

ios - Swift SceneKit - 编辑器和模拟之间的色差

Xcode 项目显示两个 git 存储库(只有一个是正确的);提交给两者

iphone - TestFlight 不报告崩溃

ios - Swift:我无法将 Firebase FIRAuth 函数中的变量传回父函数中声明的变量

android - 如何以xamarin形式通过指纹注册用户?