Camera

Camera configuration information and video related data should be provided in the form of CMSampleBufferRef to ARGear. Using the data, ARGear provides Face Tracking feature.

Using AVCaptureSession, setup your camera first. Video frames and related face information can be obtained from AVCaptureVideoDataOutputSampleBufferDelegate and AVCaptureMetadataOutputObjectsDelegate in AVCaptureVideoDataOutput and AVCaptureMetadataOutput classes respectively.

Then, pass sampleBuffer and connection, or metadataObjects and connection received from Delegate functions above to updateSampleBuffer and updateMetadataObjects in ARGSession Interface.

The sample code below describes an example of camera configuration and how to feed video frames to ARGear.

<Sample Code. Example of Passing sampleBuffer and metadataObjects to ARGSession>
ARGSession *argSession = [[ARGSession alloc] initWithARGConfig:argConfig error:&error];
// AVCaptureVideoDataOutput Delegate
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
[argSession updateSampleBuffer:sampleBuffer fromConnection:connection];
}
// AVCaptureMetadataOutput Delegate
- (void)captureOutput:(AVCaptureOutput *)output didOutputMetadataObjects:(NSArray<__kindof AVMetadataObject *> *)metadataObjects fromConnection:(AVCaptureConnection *)connection {
[argSession updateMetadataObjects:metadataObjects fromConnection:connection];
}