MLKitFaceDetection Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
MLKFace
@interface
MLKFace
:
NSObject
A human face detected in an image.
-
The rectangle containing the detected face relative to the image in the view coordinate system.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
CGRect
frame
;
-
An array of all the landmarks in the detected face.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
NSArray
<
MLKFaceLandmark
*>
*
_Nonnull
landmarks
;
-
An array of all the contours in the detected face.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
NSArray
<
MLKFaceContour
*>
*
_Nonnull
contours
;
-
Indicates whether the face has a tracking ID.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
BOOL
hasTrackingID
;
-
The tracking identifier of the face.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
NSInteger
trackingID
;
-
Indicates whether the detector found the head x euler angle.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
BOOL
hasHeadEulerAngleX
;
-
Indicates the rotation of the face about the horizontal axis of the image. Positive x euler angle
is when the face is turned upward in the image that is being processed.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
CGFloat
headEulerAngleX
;
-
Indicates whether the detector found the head y euler angle.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
BOOL
hasHeadEulerAngleY
;
-
Indicates the rotation of the face about the vertical axis of the image. Positive y euler angle
is when the face is turned towards the right side of the image that is being processed.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
CGFloat
headEulerAngleY
;
-
Indicates whether the detector found the head z euler angle.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
BOOL
hasHeadEulerAngleZ
;
-
Indicates the rotation of the face about the axis pointing out of the image. Positive z euler
angle is a counter-clockwise rotation within the image plane.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
CGFloat
headEulerAngleZ
;
-
Indicates whether a smiling probability is available.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
BOOL
hasSmilingProbability
;
-
Probability that the face is smiling.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
CGFloat
smilingProbability
;
-
Indicates whether a left eye open probability is available.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
BOOL
hasLeftEyeOpenProbability
;
-
Probability that the face’s left eye is open.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
CGFloat
leftEyeOpenProbability
;
-
Indicates whether a right eye open probability is available.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
BOOL
hasRightEyeOpenProbability
;
-
Probability that the face’s right eye is open.
Declaration
Objective-C
@property
(
nonatomic
,
readonly
)
CGFloat
rightEyeOpenProbability
;
-
Declaration
Objective-C
-
(
nonnull
instancetype
)
init
;
-
Returns the landmark, if any, of the given type in this detected face.
Parameters
type
The type of the facial landmark.
Return Value
The landmark of the given type in this face. nil
if there isn’t one.
-
Returns the contour, if any, of the given type in this detected face.
Parameters
type
The type of the facial contour.
Return Value
The contour of the given type in this face. nil
if there isn’t one.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eMLKFace\u003c/code\u003e represents a human face detected within an image, providing information about its location and features.\u003c/p\u003e\n"],["\u003cp\u003eIt includes properties like the face's bounding box (\u003ccode\u003eframe\u003c/code\u003e), facial landmarks (\u003ccode\u003elandmarks\u003c/code\u003e), and contours (\u003ccode\u003econtours\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eMLKFace\u003c/code\u003e can also provide information about head pose (Euler angles), smiling probability, and eye open probabilities.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can access specific landmarks and contours using their respective types through methods like \u003ccode\u003elandmarkOfType:\u003c/code\u003e and \u003ccode\u003econtourOfType:\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eTracking faces across frames is supported if a \u003ccode\u003etrackingID\u003c/code\u003e is available, indicated by the \u003ccode\u003ehasTrackingID\u003c/code\u003e property.\u003c/p\u003e\n"]]],["MLKFace represents a detected human face in an image. Key information includes the face's `frame` (location), `landmarks`, and `contours`. It can provide a `trackingID`, and head rotation data like `headEulerAngleX`, `headEulerAngleY`, and `headEulerAngleZ`. The class also provides probability data, such as `smilingProbability`, `leftEyeOpenProbability`, and `rightEyeOpenProbability`. Methods are available to retrieve specific landmarks and contours by their type.\n"],null,["# MLKitFaceDetection Framework Reference\n\nMLKFace\n=======\n\n\n @interface MLKFace : NSObject\n\nA human face detected in an image.\n- `\n ``\n ``\n `\n\n ### [frame](#/c:objc(cs)MLKFace(py)frame)\n\n `\n ` \n The rectangle containing the detected face relative to the image in the view coordinate system. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) CGRect frame;\n\n- `\n ``\n ``\n `\n\n ### [landmarks](#/c:objc(cs)MLKFace(py)landmarks)\n\n `\n ` \n An array of all the landmarks in the detected face. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) NSArray\u003c../Classes/MLKFaceLandmark.html *\u003e *_Nonnull landmarks;\n\n- `\n ``\n ``\n `\n\n ### [contours](#/c:objc(cs)MLKFace(py)contours)\n\n `\n ` \n An array of all the contours in the detected face. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) NSArray\u003c../Classes/MLKFaceContour.html *\u003e *_Nonnull contours;\n\n- `\n ``\n ``\n `\n\n ### [hasTrackingID](#/c:objc(cs)MLKFace(py)hasTrackingID)\n\n `\n ` \n Indicates whether the face has a tracking ID. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) BOOL hasTrackingID;\n\n- `\n ``\n ``\n `\n\n ### [trackingID](#/c:objc(cs)MLKFace(py)trackingID)\n\n `\n ` \n The tracking identifier of the face. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) NSInteger trackingID;\n\n- `\n ``\n ``\n `\n\n ### [hasHeadEulerAngleX](#/c:objc(cs)MLKFace(py)hasHeadEulerAngleX)\n\n `\n ` \n Indicates whether the detector found the head x euler angle. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) BOOL hasHeadEulerAngleX;\n\n- `\n ``\n ``\n `\n\n ### [headEulerAngleX](#/c:objc(cs)MLKFace(py)headEulerAngleX)\n\n `\n ` \n Indicates the rotation of the face about the horizontal axis of the image. Positive x euler angle\n is when the face is turned upward in the image that is being processed. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) CGFloat headEulerAngleX;\n\n- `\n ``\n ``\n `\n\n ### [hasHeadEulerAngleY](#/c:objc(cs)MLKFace(py)hasHeadEulerAngleY)\n\n `\n ` \n Indicates whether the detector found the head y euler angle. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) BOOL hasHeadEulerAngleY;\n\n- `\n ``\n ``\n `\n\n ### [headEulerAngleY](#/c:objc(cs)MLKFace(py)headEulerAngleY)\n\n `\n ` \n Indicates the rotation of the face about the vertical axis of the image. Positive y euler angle\n is when the face is turned towards the right side of the image that is being processed. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) CGFloat headEulerAngleY;\n\n- `\n ``\n ``\n `\n\n ### [hasHeadEulerAngleZ](#/c:objc(cs)MLKFace(py)hasHeadEulerAngleZ)\n\n `\n ` \n Indicates whether the detector found the head z euler angle. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) BOOL hasHeadEulerAngleZ;\n\n- `\n ``\n ``\n `\n\n ### [headEulerAngleZ](#/c:objc(cs)MLKFace(py)headEulerAngleZ)\n\n `\n ` \n Indicates the rotation of the face about the axis pointing out of the image. Positive z euler\n angle is a counter-clockwise rotation within the image plane. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) CGFloat headEulerAngleZ;\n\n- `\n ``\n ``\n `\n\n ### [hasSmilingProbability](#/c:objc(cs)MLKFace(py)hasSmilingProbability)\n\n `\n ` \n Indicates whether a smiling probability is available. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) BOOL hasSmilingProbability;\n\n- `\n ``\n ``\n `\n\n ### [smilingProbability](#/c:objc(cs)MLKFace(py)smilingProbability)\n\n `\n ` \n Probability that the face is smiling. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) CGFloat smilingProbability;\n\n- `\n ``\n ``\n `\n\n ### [hasLeftEyeOpenProbability](#/c:objc(cs)MLKFace(py)hasLeftEyeOpenProbability)\n\n `\n ` \n Indicates whether a left eye open probability is available. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) BOOL hasLeftEyeOpenProbability;\n\n- `\n ``\n ``\n `\n\n ### [leftEyeOpenProbability](#/c:objc(cs)MLKFace(py)leftEyeOpenProbability)\n\n `\n ` \n Probability that the face's left eye is open. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) CGFloat leftEyeOpenProbability;\n\n- `\n ``\n ``\n `\n\n ### [hasRightEyeOpenProbability](#/c:objc(cs)MLKFace(py)hasRightEyeOpenProbability)\n\n `\n ` \n Indicates whether a right eye open probability is available. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) BOOL hasRightEyeOpenProbability;\n\n- `\n ``\n ``\n `\n\n ### [rightEyeOpenProbability](#/c:objc(cs)MLKFace(py)rightEyeOpenProbability)\n\n `\n ` \n Probability that the face's right eye is open. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) CGFloat rightEyeOpenProbability;\n\n- `\n ``\n ``\n `\n\n ### [-init](#/c:objc(cs)MLKFace(im)init)\n\n `\n ` \n Unavailable. \n\n #### Declaration\n\n Objective-C \n\n - (nonnull instancetype)init;\n\n- `\n ``\n ``\n `\n\n ### [-landmarkOfType:](#/c:objc(cs)MLKFace(im)landmarkOfType:)\n\n `\n ` \n Returns the landmark, if any, of the given type in this detected face. \n\n #### Declaration\n\n Objective-C \n\n - (nullable ../Classes/MLKFaceLandmark.html *)landmarkOfType:(nonnull ../Type-Definitions.html#/c:MLKFaceLandmark.h@T@MLKFaceLandmarkType)type;\n\n #### Parameters\n\n |--------------|----------------------------------|\n | ` `*type*` ` | The type of the facial landmark. |\n\n #### Return Value\n\n The landmark of the given type in this face. `nil` if there isn't one.\n- `\n ``\n ``\n `\n\n ### [-contourOfType:](#/c:objc(cs)MLKFace(im)contourOfType:)\n\n `\n ` \n Returns the contour, if any, of the given type in this detected face. \n\n #### Declaration\n\n Objective-C \n\n - (nullable ../Classes/MLKFaceContour.html *)contourOfType:(nonnull ../Type-Definitions.html#/c:MLKFaceContour.h@T@MLKFaceContourType)type;\n\n #### Parameters\n\n |--------------|---------------------------------|\n | ` `*type*` ` | The type of the facial contour. |\n\n #### Return Value\n\n The contour of the given type in this face. `nil` if there isn't one."]]