raw CIFilter has nil outputImage

371 views Asked by At

I get some DNG raw files and want to show them in iPhone. I use CIFilter to read the raw file, but when I try to get the outputImage, it returns nil.
The code looks like:

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];

In the line 5, the fileter.outputImage is nil and hence the final img is nil. I check the DNG file in Mac and it shows it is Adobe Raw. I also print the filter in console:

CIRAWFilterImpl: inputRequestedSushiMode=nil inputNeutralChromaticityX=0.5342335533653005 inputNeutralChromaticityY=0.4233451399853654 inputNeutralTemperature=2000 inputNeutralTint=9.616524016108169 inputNeutralLocation=[] inputEV=0 inputBoost=1 inputDraftMode=nil inputScaleFactor=1 inputIgnoreOrientation=nil inputImageOrientation=1 inputEnableSharpening=1 inputEnableNoiseTracking=1 inputEnableVendorLensCorrection=0 inputNoiseReductionAmount=0 inputLuminanceNoiseReductionAmount=nil inputColorNoiseReductionAmount=nil inputNoiseReductionSharpnessAmount=nil inputNoiseReductionContrastAmount=nil inputNoiseReductionDetailAmount=nil inputMoireAmount=nil inputDecoderVersion=nil inputBoostShadowAmount=nil inputBias=nil inputBaselineExposure=nil inputDisableGamutMap=0 inputHueMagMR=nil inputHueMagRY=nil inputHueMagYG=nil inputHueMagGC=nil inputHueMagCB=nil inputHueMagBM=nil inputLinearSpaceFilter=nil>

The inputDecoderVersion seems nil which may cause the problem(but I'm not sure).
The DNG files are downloaded from Internet, and I also try the NEF files which has the same result.

Could anyone give some advice?

1

There are 1 answers

1
scorpiozj On

It should run in real device.
In simulator, it returns nil.