我正在尝试使用 CIUnsharpMask 过滤器来处理图像。问题是返回的图像是空白的。图像视图中没有出现任何内容。我一直在为我的其余过滤器使用相同的模板,并且它们运行良好。radiusValue 和 intensityValue 都是 NSNumbers 顺便说一句。
CIImage *ciUnsharpMaskImage = [[CIImage alloc] initWithImage:preFilterImage];
CIContext *ciUnsharpMaskContext = [CIContext contextWithOptions:nil];
CIFilter *ciUnsharpMaskFilter = [CIFilter filterWithName:@"CIUnsharpMask"
keysAndValues: kCIInputImageKey, ciUnsharpMaskImage,
@"inputRadius", radiusValue,
@"inputIntensity", intensityValue, nil];
CIImage *ciUnsharpMaskOutputImage = [ciUnsharpMaskFilter outputImage];
CGImageRef ciUnsharpMaskCgimg = [ciUnsharpMaskContext
createCGImage:ciUnsharpMaskOutputImage
fromRect:[ciUnsharpMaskOutputImage extent]];
preFilterImage = [UIImage imageWithCGImage:ciUnsharpMaskCgimg];
CGImageRelease(ciUnsharpMaskCgimg);
NSLog(@"unsharp mask filter applied");
[self.imageView setImage:preFilterImage];