1

当我尝试实施 CIHueAdjust 时出现错误。应用程序以如下错误终止:-[CIImage doubleValue]: unrecognized selector sent to instance 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) 终止调用抛出异常

4

1 回答 1

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

应该

[hueFilter setValue:adjustedImage forKey:@"inputImage"];
于 2012-08-17T16:27:22.460 回答