ARGear SDK Documentations
  • Introduction
  • Android
    • 1. Quickstart
    • 2. Configuration Settings
    • 3. ARGear Overview
    • 4. ARGSession
    • 5. Camera
    • 6. Rendering
    • 7. CMS Service
    • 8. Download Contents
    • 9. Set Contents
    • 10. Media
    • 11. Switch Camera Face
    • 12. Enable Debugging Mode
    • 13. ARCore Connect API
    • 14. API Reference
  • iOS
    • 1. Quickstart
    • 2. Configuration Settings
    • 3. ARGear Overview
    • 4. ARGSession
    • 5. Camera
    • 6. Rendering
    • 7. CMS Service
    • 8. Download Contents
    • 9. Set Contents
    • 10. Media
    • 11. Switch Camera Face
    • 12. Enable Debugging Mode
    • 13. ARKit Connect API
    • 14. API Reference
  • Unity
    • 1. Quickstart
    • 2. Configuration Settings
    • 3. ARGear Plugin Overview
    • 4. ARGearManager
    • 5. ARGearCamera
    • 6. CMS Service
    • 7. Download Contents
    • 8. Set Contents
    • 9. Switch Camera Face
    • 10. Enable Debugging Mode
    • 11. API Reference
Powered by GitBook
On this page

Was this helpful?

  1. Unity

5. 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.

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();
        }
}
Previous4. ARGearManagerNext6. CMS Service

Last updated 5 years ago

Was this helpful?