class ARCameraFeed (Niantic.ARDK.AR.ARCameraFeed)

Overview

Receives camera feed data coming from the device and outputs Unity compatible textures. that can be rendered to the screen. On all platforms, an RGB format Texture will be available through the VideoFull property. Additional Texture2Ds will be available based on the current platform. More…

class ARCameraFeed: IDisposable {
public:
    // enums

    enum CameraFeedResolutionMode;
    enum TextureType;

    // structs

    struct CameraFeedResolution;

    // fields

    Action<ARCameraFeed> FeedUpdated = feed => {};

    // properties

    Matrix4x4 DisplayTransform;
    float FrameRate;
    Matrix4x4 ProjectionTransform;
    TextureType TextureMode;
    GPUFence VideoFeedFence;
    Texture VideoFull;
    Texture2D VideoTextureBGRA;
    Texture2D VideoTextureCbCr;
    Texture2D VideoTextureY;

    // methods

    ARCameraFeed(
        IARSession arSession,
        TextureType textureType,
        CameraFeedResolution cameraFeedResolution = new CameraFeedResolution(),
        bool autoDisposeOnDeinitialize = false
    );

    void Dispose();
    void SetupCameraProjectionMatrixUpdates(UnityEngine.Camera camera);
};

Detailed Documentation

Receives camera feed data coming from the device and outputs Unity compatible textures. that can be rendered to the screen. On all platforms, an RGB format Texture will be available through the VideoFull property. Additional Texture2Ds will be available based on the current platform.

Note

The textures will be be updated once per render loop.

Fields

Action<ARCameraFeed> FeedUpdated = feed => {}

Alerts subscribers when the feed has been updated with new camera images.

Properties

Matrix4x4 DisplayTransform

Affine transform for converting between normalized image coordinates and a coordinate space appropriate for rendering the camera image onscreen.

float FrameRate

Recommended target framerate when using the ARCameraFeed.

Matrix4x4 ProjectionTransform

The projection matrix of the device’s camera. This takes into account your device’s focal length, size of the sensor, distortions inherent in the lenses, autofocus, temperature, and/or etc.

TextureType TextureMode

The type of texture being output.

Note

This value will always be either TextureMode.YCbCr or TextureMode.BGRA.

GPUFence VideoFeedFence

Fence that should be waited on in other command buffers that utilize the texture output by ARCameraFeed.

Texture VideoFull

The current frame’s camera feed texture in RGB format.

Texture2D VideoTextureBGRA

When in BGRA texture mode, this value is the full BGRA texture.

Texture2D VideoTextureCbCr

When in YCbCr texture mode, this value is the CbCr component of the texture.

Texture2D VideoTextureY

When in YCbCr texture mode, this value is the Y component of the texture.

Methods

ARCameraFeed(
    IARSession arSession,
    TextureType textureType,
    CameraFeedResolution cameraFeedResolution = new CameraFeedResolution(),
    bool autoDisposeOnDeinitialize = false
)

Creates a new camera feed.

Parameters:

arSession

The ARSession to create the feed from.

textureType

The type of texture to output.

cameraFeedResolution

How to determine camera feed resolution.

autoDisposeOnDeinitialize

If true, the camera feed will clean itself up when the session is destroyed.

void SetupCameraProjectionMatrixUpdates(UnityEngine.Camera camera)

On every render update, the given camera’s projectionMatrix property will be set to the ProjectionTransform value. This allows the camera to render virtual objects in such a way as to mimic how the device’s real camera would render those objects.

Parameters:

camera

Camera used to render virtual objects