Этот код вернет CIRedEyeCorrections.Так как у меня нет фотографий с настоящим красным глазом.Я просто Google и нашел этот "redeye_incorrect_lg.jpg".Это первая женская фотография, возвращенная из изображений Google.Я обнаружил, что не все изображения красных глаз могут быть обнаружены .... поэтому убедитесь, что у вас настоящие красные глаза ...
-(void) coreImageInit
{
NSString *sourcePath = [[NSBundle mainBundle] resourcePath];
NSString *file1 = [sourcePath stringByAppendingPathComponent:@"/redeye_incorrect_lg.jpg"];
UIImage *img = [[[UIImage alloc]initWithContentsOfFile:file1]autorelease];
CIImage *image = [[CIImage alloc]initWithImage:img];
NSLog(@"after ciimage: %@", kCIImageAutoAdjustEnhance);
NSDictionary *options = [NSDictionary dictionaryWithObject:@"NO" forKey:kCIImageAutoAdjustEnhance];
NSLog(@"options: %@", options);
NSArray *adjustments = [image autoAdjustmentFiltersWithOptions:options];
NSLog(@"adjustments: %@ ", adjustments);
}
Вот мой вывод журнала, который показывает, что он обнаружил красные глаза:*
11/4/11 10:13:19.231 AM iPadTestBed: after ciimage: kCIImageAutoAdjustEnhance
11/4/11 10:13:19.232 AM iPadTestBed: options: {
kCIImageAutoAdjustEnhance = NO;
}
11/4/11 10:13:19.879 AM iPadTestBed: adjustments: (
"<CIRedEyeCorrections: inputImage=<CIImage: 0x878a980 extent [0 0 370 427]> inputCameraModel=nil inputCorrectionInfo=(\n {\n averageSkinLuminance = 0;\n bitmaskThreshold = \"0.1372549\";\n bitmaskX = \"0.372973\";\n bitmaskY = \"0.5854801\";\n cornealReflectionThreshold = \"0.854902\";\n cornealReflectionX = \"0.3783784\";\n cornealReflectionY = \"0.587822\";\n existingPupilAverage = \"0.1607843\";\n existingPupilHigh = \"0.345098\";\n existingPupilLow = \"0.01176471\";\n existingPupilMedium = \"0.1333333\";\n finalEyeCase = 0;\n forceCase = 0;\n fullImageHeight = 427;\n fullImageWidth = 370;\n imageOrientation = 1;\n imageSignalToNoiseRatio = 20;\n imageSpecialValue = 0;\n interocularDistance = \"0.2284475\";\n pointX = \"0.3702703\";\n pointY = \"0.587822\";\n pupilShadeAlignment = 1;\n pupilShadeAverage = \"0.2117647\";\n pupilShadeHigh = \"0.2901961\";\n pupilShadeLow = \"0.1372549\";\n pupilShadeMedium = \"0.2117647\";\n repairRectangleMaximumX = \"0.4162162\";\n repairRectangleMaximumY = \"0.557377\";\n repairRectangleMinimumX = \"0.3513514\";\n repairRectangleMinimumY = \"0.6135831\";\n searchRectangleMaximumX = \"0.4864865\";\n searchRectangleMaximumY = \"0.4871194\";\n searchRectangleMinimumX = \"0.2540541\";\n searchRectangleMinimumY = \"0.6885245\";\n size = \"0.012472\";\n snappedX = \"0.3702703\";\n snappedY = \"0.587822\";\n },\n {\n averageSkinLuminance = 0;\n bitmaskThreshold = \"0.09411766\";\n bitmaskX = \"0.7081081\";\n bitmaskY = \"0.6533958\";\n cornealReflectionThreshold = \"0.8745099\";\n cornealReflectionX = \"0.7081081\";\n cornealReflectionY = \"0.6487119\";\n existingPupilAverage = \"0.1686275\";\n existingPupilHigh = \"0.3490196\";\n existingPupilLow = \"0.03921569\";\n existingPupilMedium = \"0.1372549\";\n finalEyeCase = 0;\n forceCase = 0;\n fullImageHeight = 427;\n fullImageWidth = 370;\n imageOrientation = 1;\n imageSignalToNoiseRatio = 20;\n imageSpecialValue = 0;\n interocularDistance = \"0.2284475\";\n pointX = \"0.7081081\";\n pointY = \"0.6557377\";\n pupilShadeAlignment = 1;\n pupilShadeAverage = \"0.2117647\";\n pupilShadeHigh = \"0.2901961\";\n pupilShadeLow = \"0.1372549\";\n pupilShadeMedium = \"0.2117647\";\n repairRectangleMaximumX = \"0.7405406\";\n repairRectangleMaximumY = \"0.6229508\";\n repairRectangleMinimumX = \"0.6864865\";\n repairRectangleMinimumY = \"0.6697892\";\n searchRectangleMaximumX = \"0.827027\";\n searchRectangleMaximumY = \"0.5526932\";\n searchRectangleMinimumX = \"0.5945946\";\n searchRectangleMinimumY = \"0.7540984\";\n size = \"0.010893\";\n snappedX = \"0.7081081\";\n snappedY = \"0.6557377\";\n }\n)>"
)