MLKitFaceDetection Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
Face
A human face detected in an image.
-
The rectangle containing the detected face relative to the image in the view coordinate system.
Declaration
Swift
var
frame
:
CGRect
{
get
}
-
An array of all the landmarks in the detected face.
-
An array of all the contours in the detected face.
-
Indicates whether the face has a tracking ID.
Declaration
Swift
var
hasTrackingID
:
Bool
{
get
}
-
The tracking identifier of the face.
Declaration
Swift
var
trackingID
:
Int
{
get
}
-
Indicates whether the detector found the head x euler angle.
Declaration
Swift
var
hasHeadEulerAngleX
:
Bool
{
get
}
-
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
Swift
var
headEulerAngleX
:
CGFloat
{
get
}
-
Indicates whether the detector found the head y euler angle.
Declaration
Swift
var
hasHeadEulerAngleY
:
Bool
{
get
}
-
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
Swift
var
headEulerAngleY
:
CGFloat
{
get
}
-
Indicates whether the detector found the head z euler angle.
Declaration
Swift
var
hasHeadEulerAngleZ
:
Bool
{
get
}
-
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
Swift
var
headEulerAngleZ
:
CGFloat
{
get
}
-
Indicates whether a smiling probability is available.
Declaration
Swift
var
hasSmilingProbability
:
Bool
{
get
}
-
Probability that the face is smiling.
Declaration
Swift
var
smilingProbability
:
CGFloat
{
get
}
-
Indicates whether a left eye open probability is available.
Declaration
Swift
var
hasLeftEyeOpenProbability
:
Bool
{
get
}
-
Probability that the face’s left eye is open.
Declaration
Swift
var
leftEyeOpenProbability
:
CGFloat
{
get
}
-
Indicates whether a right eye open probability is available.
Declaration
Swift
var
hasRightEyeOpenProbability
:
Bool
{
get
}
-
Probability that the face’s right eye is open.
Declaration
Swift
var
rightEyeOpenProbability
:
CGFloat
{
get
}
-
-
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 for face bounds, landmarks, contours, head pose, and probabilities for smiling and eye openness.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can access specific facial landmarks and contours using provided methods.\u003c/p\u003e\n"],["\u003cp\u003eTracking identifiers are available if supported, enabling face tracking across frames.\u003c/p\u003e\n"],["\u003cp\u003eEuler angles provide information on face rotation along three axes within the image.\u003c/p\u003e\n"]]],["This describes the `Face` class, representing a detected human face in an image. Key properties include the face's `frame` (rectangle), `landmarks`, and `contours`. It offers methods to retrieve specific `landmark` or `contour` types. The class also provides attributes like `trackingID`, head rotation angles (`headEulerAngleX/Y/Z`), and probabilities related to smiling, left eye open, and right eye open. Additionally there are indicators that describe whether or not the attribute has been found.\n"],null,["# MLKitFaceDetection Framework Reference\n\nFace\n====\n\n class Face : 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 Swift \n\n var frame: CGRect { get }\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 Swift \n\n var landmarks: [../Classes/FaceLandmark.html] { get }\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 Swift \n\n var contours: [../Classes/FaceContour.html] { get }\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 Swift \n\n var hasTrackingID: Bool { get }\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 Swift \n\n var trackingID: Int { get }\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 Swift \n\n var hasHeadEulerAngleX: Bool { get }\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 Swift \n\n var headEulerAngleX: CGFloat { get }\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 Swift \n\n var hasHeadEulerAngleY: Bool { get }\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 Swift \n\n var headEulerAngleY: CGFloat { get }\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 Swift \n\n var hasHeadEulerAngleZ: Bool { get }\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 Swift \n\n var headEulerAngleZ: CGFloat { get }\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 Swift \n\n var hasSmilingProbability: Bool { get }\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 Swift \n\n var smilingProbability: CGFloat { get }\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 Swift \n\n var hasLeftEyeOpenProbability: Bool { get }\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 Swift \n\n var leftEyeOpenProbability: CGFloat { get }\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 Swift \n\n var hasRightEyeOpenProbability: Bool { get }\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 Swift \n\n var rightEyeOpenProbability: CGFloat { get }\n\n- `\n ``\n ``\n `\n\n ### [-init](#/c:objc(cs)MLKFace(im)init)\n\n `\n ` \n Unavailable.\n- `\n ``\n ``\n `\n\n ### [landmark(ofType:)](#/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 Swift \n\n func landmark(ofType type: ../Type-Definitions.html#/c:MLKFaceLandmark.h@T@MLKFaceLandmarkType) -\u003e ../Classes/FaceLandmark.html?\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 ### [contour(ofType:)](#/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 Swift \n\n func contour(ofType type: ../Type-Definitions.html#/c:MLKFaceContour.h@T@MLKFaceContourType) -\u003e ../Classes/FaceContour.html?\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."]]