原始CIFilter的输出图像为nil

时间:2018-10-04 12:08:31

标签: ios core-image cifilter dng

我得到了一些DNG原始文件,并希望在iPhone中显示它们。我使用CIFilter来读取原始文件,但是当我尝试获取outputImage时,它将返回nil
代码如下:

NSURL *url = [[NSBundle mainBundle] URLForResource:@"1" withExtension:@"DNG"];
CIFilter *filter = nil;
filter = [CIFilter filterWithImageURL:url options:nil];
[filter setValue:@(2000) forKey:kCIInputNeutralTemperatureKey];
CIImage *imgCI = [filter.outputImage imageByApplyingFilter:@"CIVignette"];//5
UIImage *img = [UIImage imageWithCIImage:imgCI];

在第5行中,fileter.outputImage为零,因此最后一个img为零。我在Mac中检查了DNG文件,它显示为Adobe Raw。我还在控制台中打印filter

  

CIRAWFilterImpl:inputRequestedSushiMode = nil inputNeutralChromaticityX = 0.5342335533653005 inputNeutralChromaticityY = 0.4233451399853654 inputNeutralTemperature = 2000 inputNeutralTint = 9.616524016108169 inputNeutralLocation = [] inputEV = 0 inputBoost = 1 inputEnrafableMode = nilensable inputInputDraftMode = nable 0 inputNoiseReductionAmount = 0 inputLuminanceNoiseReductionAmount =零inputColorNoiseReductionAmount =零inputNoiseReductionSharpnessAmount =零inputNoiseReductionContrastAmount =零inputNoiseReductionDetailAmount =零inputMoireAmount =零inputDecoderVersion =零inputBoostShadowAmount =零inputBias =零inputBaselineExposure =零inputDisableGamutMap = 0 inputHueMagMR =零inputHueMagRY =零inputHueMagYG =零inputHueMagGC =零inputHueMagCB = nil inputHueMagBM = nil inputLinearSpaceFilter = nil>

inputDecoderVersion似乎为零,这可能会引起问题(但我不确定)。
DNG文件是从Internet下载的,我也尝试了具有相同结果的NEF文件。

有人可以提些建议吗?

1 个答案:

答案 0 :(得分:0)

它应该在真实设备中运行。
在模拟器中,它返回nil