iOS Developer Library

Developer

AVFoundation Framework Reference AVMetadataFaceObject Class Reference

Options
Deployment Target:

On This Page
Language:

AVMetadataFaceObject

Inherits From


Conforms To


Import Statement


Swift

import AVFoundation

Objective-C

@import AVFoundation;

Availability


Available in iOS 6.0 and later

The AVMetadataFaceObject class is a concrete subclass of AVMetadataObject that defines the features of a single detected face. You can retrieve instances of this class from the output of an AVCaptureMetadataOutput object on devices that support face detection.

  • faceID faceID Property

    The unique ID for this face metadata object. (read-only)

    Declaration

    Swift

    var faceID: Int { get }

    Objective-C

    @property(readonly) NSInteger faceID

    Discussion

    Each time a face enters the picture, it is assigned a new unique identifier, which you can use to reference the face in your code. Face IDs are not reused, and the same face leaving and entering the picture again is assigned a new identifier.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later

  • A Boolean value indicating whether there is a valid roll angle associated with the face. (read-only)

    Declaration

    Swift

    var hasRollAngle: Bool { get }

    Objective-C

    @property(readonly) BOOL hasRollAngle

    Discussion

    If the value of this property is NOfalse, the value in the rollAngle property is invalid and must not be accessed.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later

  • rollAngle rollAngle Property

    The roll angle of the face specified in degrees. (read-only)

    Declaration

    Swift

    var rollAngle: CGFloat { get }

    Objective-C

    @property(readonly) CGFloat rollAngle

    Discussion

    The roll angle represents the side-to-side tilt of the face relative to the metadata’s bounding rectangle. A value of 0.0 yields a face that is level relative to the picture, whereas a value of 90 yields a face that is perpendicular relative to the picture.

    You must check the value of the hasRollAngle property before accessing this property. If the value in the hasRollAngle property is NOfalse, reading the value in this property raises an exception.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later

    See Also

    hasRollAngle

  • A Boolean value indicating whether there is a valid yaw angle associated with the face. (read-only)

    Declaration

    Swift

    var hasYawAngle: Bool { get }

    Objective-C

    @property(readonly) BOOL hasYawAngle

    Discussion

    If the value of this property is NOfalse, the value in the yawAngle property is invalid and must not be accessed.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later

  • yawAngle yawAngle Property

    The yaw angle of the face specified in degrees. (read-only)

    Declaration

    Swift

    var yawAngle: CGFloat { get }

    Objective-C

    @property(readonly) CGFloat yawAngle

    Discussion

    The yaw angle represents the rotation of the face around the vertical axis. A value of 0.0 yields a face that is looking directly at the camera, whereas a yaw angle of 90 degrees yields a face whose eye line is perpendicular to that of the camera.

    You must check the value of the hasYawAngle property before accessing this property. If the value in the hasYawAngle property is NOfalse, reading the value in this property raises an exception.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later

    See Also

    hasYawAngle

  • A metadata type string for face detection metadata.

    Declaration

    Swift

    let AVMetadataObjectTypeFace: String

    Objective-C

    NSString *const AVMetadataObjectTypeFace;

    Constants

    • AVMetadataObjectTypeFace

      AVMetadataObjectTypeFace

      The type string stored in the type property of metadata objects that contain face detection data.

      Available in iOS 6.0 and later