CIDetector Class Reference
| Inherits from | |
| Conforms to | |
| Framework | Library/Frameworks/CoreImage.framework |
| Availability | Available in OS X v10.7 and later. |
| Declared in | CIDetector.h |
Overview
A CIDetector object uses image processing to look for features (i.e., faces) in a picture. You might also want to use the CIFaceFeature class, which can find eye and mouth positions in faces that are detected with CIDetector.
This class can maintain many state variables that can impact performance. So for best performance, reuse CIDetector instances instead of creating new ones.
Class Methods
detectorOfType:context:options:
Creates and returns a configured detector.
Parameters
- type
A string indicating the kind of detector you are interested in. See
“Detector Types”.- context
A Core Image context that the detector can use when analyzing an image.
- options
A dictionary containing details on how you want the detector to be configured. See
“Detector Configuration Keys”.
Return Value
A configured detector.
Discussion
A CIDetector object can potentially create and hold a significant amount of resources. Where possible, reuse the same CIDetector instance. Also, when processing CIImages with a detector object, your application performs better if the CIContext used to initialize the detector is the same context used to process the CIImage objects it will process.
Availability
- Available in OS X v10.7 and later.
Declared In
CIDetector.hInstance Methods
featuresInImage:
Searches for features in an image.
Parameters
- image
The image you want to examine.
Return Value
An array of CIFeature objects. Each object represents a feature detected in the image.
Availability
- Available in OS X v10.7 and later.
Declared In
CIDetector.hfeaturesInImage:options:
Searches for features in an image based on the specified image orientation.
Parameters
- image
The image you want to examine.
- options
A dictionary that specifies the orientation of the image. The detection is adjusted to account for the image orientation but the coordinates in the returned feature objects are based on those of the image.
Return Value
An array of CIFeature objects. Each object represents a feature detected in the image.
Availability
- Available in OS X v10.8 and later.
Declared In
CIDetector.hConstants
Detector Types
Strings used to declare the detector for which you are interested.
NSString* const CIDetectorTypeFace
Constants
CIDetectorTypeFaceA detector that searches for faces in a photograph.
Available in OS X v10.7 and later.
Declared in
CIDetector.h.
Detector Configuration Keys
Keys used in the options dictionary to configure a detector.
NSString* const CIDetectorAccuracy;
Constants
CIDetectorAccuracyA key used to specify the desired accuracy for the detector.
The value associated with the key should be one of the values found in
“Detector Accuracy Options”.Available in OS X v10.7 and later.
Declared in
CIDetector.h.CIDetectorTrackingA key used to enable or disable face tracking for the detector. Use this option when you want to track faces across frames in a video.
Available in OS X v10.8 and later.
Declared in
CIDetector.h.CIDetectorMinFeatureSizeA key used to specify the minimum size that the detector will recognize as a feature.
The value for this key is an
NSNumberobject ranging from 0.0 through 1.0 that represents a fraction of the minor dimension of the image.Available in OS X v10.8 and later.
Declared in
CIDetector.h.
Detector Accuracy Options
Value options used to specify the desired accuracy of the detector.
NSString* const CIDetectorAccuracyLow; NSString* const CIDetectorAccuracyHigh;
Constants
CIDetectorAccuracyLowIndicates that the detector should choose techniques that are lower in accuracy, but can be processed more quickly.
Available in OS X v10.7 and later.
Declared in
CIDetector.h.CIDetectorAccuracyHighIndicates that the detector should choose techniques that are higher in accuracy, even if it requires more processing time.
Available in OS X v10.7 and later.
Declared in
CIDetector.h.
Feature Orientation Keys
Specifies an image orientation to use when detecting features.
NSString* const CIDetectorImageOrientation;
Constants
CIDetectorImageOrientationA key used to specify the display orientation of the image whose features you want to detect. This key is an
NSNumberobject with the same value as defined by the TIFF and EXIF specifications; values can range from 1 through 8. The value specifies where the origin (0,0) of the image is located. If not present, the default value is 1, which means the origin of the image is top, left. For details on the image origin specified by each value, seekCGImagePropertyOrientation.Available in OS X v10.8 and later.
Declared in
CIDetector.h.
© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-09-19)