GARAugmentedFaceSession

ARCore Augmented Face Session.

Class is used to take in a series of CVPixelBufferRefs and outputs a 3D Face Mesh for the detected face.

Summary

Inheritance

Inherits from: NSObject

Properties

currentFrame
The most recent frame created from calling updateWithPixelBuffer:timestamp:recognitionRotation:.
delegate
Delegate that receives callbacks from the face session.
delegateQueue
dispatch_queue_t
The dispatch queue through which the face session calls your delegate methods.

Public methods

initWithFieldOfView:error:
instancetype _Nullable
Initializes a GARAugmentedFaceSession with the camera's field of view.
updateWithPixelBuffer:timestamp:recognitionRotation:
BOOL
Provides the Face Mesh API with a new pixel buffer so it will capture a face frame.

Properties

currentFrame

@property(atomic, readonly, nullable) GARAugmentedFaceFrame *currentFrame;

The most recent frame created from calling updateWithPixelBuffer:timestamp:recognitionRotation:.

delegate

@property(atomic, weak, nullable) id delegate;

Delegate that receives callbacks from the face session.

delegateQueue

@property(atomic, nullable) dispatch_queue_t delegateQueue;

The dispatch queue through which the face session calls your delegate methods.

Public methods

initWithFieldOfView:error:

- (instancetype _Nullable)initWithFieldOfView:
(float) fieldOfView
error:
(NSError **) error

Initializes a GARAugmentedFaceSession with the camera's field of view.

Details
Parameters
fieldOfView
The camera device's horizontal field of view in degrees.
error
Out parameter for an NSError. Possible errors:
Returns
An initialized GARAugmentedFaceSession or nil if there is an error.

updateWithPixelBuffer:timestamp:recognitionRotation:

- (BOOL)updateWithPixelBuffer:
(CVPixelBufferRef) pixelBuffer
timestamp:
(NSTimeInterval) timestamp
recognitionRotation:
(NSUInteger) recognitionRotation

Provides the Face Mesh API with a new pixel buffer so it will capture a face frame.

Details
Parameters
pixelBuffer
CVPixelBufferRef containing camera image.
timestamp
Timestamp that you wish to associate with this image. Timestamps must monotonically increase on successive calls to this method.
recognitionRotation
The counter-clockwise rotation in degrees required to orient the face upwards for face detection. NOTE: The default camera orientation is landscape left. When holding the phone in portrait and taking a selfie this should be set to 270. The 270 degree rotation rotates a landscape camera image to portrait with the head pointing up.
Returns
YES if the frame was accepted for processing. NO if the frame was not accepted for processing. This will occur when the session has too many frames in the queue to process.