【问题标题】:Using CINoiseReduction - get blank image?使用 CINoiseReduction - 获取空白图像?
【发布时间】:2013-08-14 15:59:27
【问题描述】:

我正在使用 CI 过滤器,但在降噪方面遇到了一些问题。基本上我从中得到一个空白图像。

我确定我只是缺少一些简单的东西。

这是我的代码:

CGImageRef imageRef = [self.iv.image CGImage];
CIContext *context = [CIContext contextWithOptions:nil]; // 1
CIImage *ciImage = [CIImage imageWithCGImage:imageRef]; // 2
CIFilter *filter = [CIFilter filterWithName:@"CINoiseReduction" ];
[filter setDefaults];
[filter setValue:ciImage forKey:@"inputImage"]; // 3
CIImage *ciResult = [filter valueForKey:kCIOutputImageKey]; // 4
CGImageRef cgImage = [context createCGImage:ciResult fromRect:[ciResult extent]];
UIImage *img = [UIImage imageWithCGImage:cgImage];
self.iv.image = img;

【问题讨论】:

    标签: ios core-graphics core-image


    【解决方案1】:

    Aaaaaaand... 这是因为该过滤器在 iOS 上不可用,所以行:

    CIFilter *filter = [CIFilter filterWithName:@"CINoiseReduction" ];
    

    ...返回空值。因为,你知道,这可能是你真正想要的 :)

    Here's the list of CI filters, along with notes on availability.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-08-18
      • 1970-01-01
      • 2015-11-18
      • 2021-04-22
      • 1970-01-01
      • 1970-01-01
      • 2014-09-14
      相关资源
      最近更新 更多