4. ARGearCamera

Configuration information and image frame data from ARGear Framework (result texture, blendshapes, segmentation) should be updated for Unity through the onPostRender() event function.

Face Tracking, Landmark, and Segmentation information can be obtained from ARGear.

ARGear provides a basic function to draw ARGear data, ARGearCamera.DrawFrame(). For more advanced rendering, the sample code below shows how to obtain data from ARGear and custom render camera images with ARGearCamera for Unity.

C#
C#
How to handle provided data from ARGear Session and ARGearCamera
private void DrawCameraFrame(int width, int height)
{
System.IntPtr tex = System.IntPtr.Zero;
int frameWidth = 0, frameHeight = 0;
if (_arGearNative != null)
{
_arGearNative.OnDrawFrame(width, height);
tex = _arGearNative.GetRenderedTexID();
frameWidth = _arGearNative.GetCameraWidth();
frameHeight = _arGearNative.GetCameraHeight();
}
if (tex != System.IntPtr.Zero)
{
SetRendererMainTexture(frameWidth, frameHeight, tex);
}
if (_arGearNative != null)
{
var num = 0;
for (var i = 0; i < _argFaces.Length; i++)
{
_argFaces[i].isValid = _arGearNative.TrackedFaceValidation(i);
if (_argFaces[i].isValid)
{
num++;
_argFaces[i].translationVector = _arGearNative.GetTranslationVector(i);
_argFaces[i].rotationMatrix = _arGearNative.GetRotationMatrix(i);
_argFaces[i].landmark = _arGearNative.GetLandmark(i);
}
}
_argSegmentation.textureId = _arGearNative.GetSegmentationTextureId();
}
}