Created
June 23, 2011 19:05
-
-
Save Clancey/1043336 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ios version | |
NSDictionary *contextDict = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:@"kCIContextUseSoftwareRenderer"]; | |
CIContext *ciContext = [CIContext contextWithOptions:contextDict]; | |
NSDictionary *detectorDict = [NSDictionary dictionaryWithObject:@"CIDetectorAccuracyHigh" forKey:@"CIDetectorAccuracy"]; | |
CIDetector *detector = [CIDetector detectorOfType:@"CIDetectorTypeFace" context:ciContext options:detectorDict]; | |
CIImage *image = [[CIImage alloc] initWithImage:self.faceImage.image]; | |
NSArray *features = [detector featuresInImage:image]; | |
*/ | |
string imageFile = "IMG_0540.jpg"; | |
NSDictionary contextDict = NSDictionary.FromObjectAndKey(NSNumber.FromBoolean(false),new NSString("kCIContextUseSoftwareRenderer")); | |
NSDictionary detectorOptions = NSDictionary.FromObjectAndKey(new NSString("CIDetectorAccuracyHigh"),new NSString("CIDetectorAccuracy")); | |
CIContext context = CIContext.FromOptions(contextDict); | |
CIDetector detector = CIDetector.FromType("CIDetectorTypeFace",context,detectorOptions); | |
var image = new UIImage(imageFile); | |
var ciImage = CIImage.FromCGImage(image.CGImage); | |
var features = detector.FeaturesInImage(ciImage); | |
//detector. | |
Console.WriteLine(features.Count()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment