class ARReferenceImageFactory (Niantic.ARDK.AR.ReferenceImage.ARReferenceImageFactory)

Overview

This class contains methods to create IARReferenceImage instances. More…

class ARReferenceImageFactory {
public:
    // methods

    static IARReferenceImage Create(
        string name,
        byte[] rawBytes,
        int width,
        int height,
        ByteOrderInfo byteOrderInfo,
        AlphaInfo alphaInfo,
        int componentsPerPixel,
        float physicalWidth,
        Orientation orientation = Orientation.Up
    );

    static IARReferenceImage Create(
        string name,
        byte[] rawBytesOfJpg,
        int bufferSize,
        float physicalWidth,
        Orientation orientation = Orientation.Up
    );

    static IARReferenceImage Create(
        string name,
        string filePath,
        float physicalWidth,
        Orientation orientation = Orientation.Up
    );

    static void CreateAsync(
        string name,
        byte[] rawBytes,
        int width,
        int height,
        ByteOrderInfo byteOrderInfo,
        AlphaInfo alphaInfo,
        int componentsPerPixel,
        float physicalWidth,
        Action<IARReferenceImage> completionHandler,
        Orientation orientation = Orientation.Up
    );

    static void CreateAsync(
        string name,
        byte[] rawBytesOfJpg,
        int bufferSize,
        float physicalWidth,
        Action<IARReferenceImage> completionHandler,
        Orientation orientation = Orientation.Up
    );

    static void CreateAsync(
        string name,
        string filePath,
        float physicalWidth,
        Action<IARReferenceImage> completionHandler,
        Orientation orientation = Orientation.Up
    );
};

Detailed Documentation

This class contains methods to create IARReferenceImage instances.

Methods

static IARReferenceImage Create(
    string name,
    byte[] rawBytes,
    int width,
    int height,
    ByteOrderInfo byteOrderInfo,
    AlphaInfo alphaInfo,
    int componentsPerPixel,
    float physicalWidth,
    Orientation orientation = Orientation.Up
)

Creates a new reference image from raw image buffer (RGBA, BGRA, etc), physical size, and orientation.

Note

Not supported in Editor.

Note

The ARReferenceImage will contain the full image buffer until it is destroyed. Unless reuse of the constructed ARReferenceImage is required in the near future, it is recommended to destroy images after adding them to a configuration.

Note

Currently, only Orientation.Up is supported

Note

May return null if creating the reference image fails (not enough features, not supported)

Parameters:

name

The name of the image (for identifying unique images upon detection)

rawBytes

The base image from which to create the reference image

width

The width of the image in pixels

height

The height of the image in pixels

byteOrderInfo

The endianness of each pixel (See ByteOrderInfo)

alphaInfo

The location of the alpha channel in each pixel (See AlphaInfo)

physicalWidth

The physical width of the image in meters. Be as accurate as possible, entering an incorrect physical size will result in detecting an anchor that’s the wrong distance from the camera.

orientation

The orientation of the provided image. (See Orientation for more information)

static IARReferenceImage Create(
    string name,
    byte[] rawBytesOfJpg,
    int bufferSize,
    float physicalWidth,
    Orientation orientation = Orientation.Up
)

Creates a new reference image from the contents of a JPG image (in byte[] form), physical size, and orientation.

Note

Not supported in Editor.

Note

The ARReferenceImage will contain the full image buffer until it is destroyed. Unless reuse of the constructed ARReferenceImage is required in the near future, it is recommended to destroy images after adding them to a configuration.

Note

WARNING: JPG decompression contains a security vulnerability, only use this constructor on a byte buffer that can be verified to be a JPG image (manually uploaded data, server verification, etc).

Note

May return null if creating the reference image fails (not enough features, not supported)

Parameters:

name

The name of the image (for identifying unique images upon detection)

rawBytes

The JPG image from which to create the reference image

physicalWidth

The physical width of the image in meters. Be as accurate as possible, entering an incorrect physical size will result in detecting an anchor that’s the wrong distance from the camera.

orientation

The orientation of the image (Currently only Up is supported)

static IARReferenceImage Create(
    string name,
    string filePath,
    float physicalWidth,
    Orientation orientation = Orientation.Up
)

Creates a new reference image from a JPG file and the physical width.

Note

Not supported in Editor.

Note

The ARReferenceImage will contain the full image buffer until it is destroyed. Unless reuse of the constructed ARReferenceImage is required in the near future, it is recommended to destroy images after adding them to a configuration.

Note

WARNING: JPG decompression contains a security vulnerability, only use this constructor on a file that can be verified to be a JPG image (manually uploaded data, server verification, etc).

Note

May return null if creating the reference image fails (not enough features, not supported)

Parameters:

name

The name of the image (for identifying unique images upon detection)

filePath

The JPG image from which to create the reference image

physicalWidth

The physical width of the image in meters.

orientation

The orientation of the image (Currently only Up is supported)

static void CreateAsync(
    string name,
    byte[] rawBytes,
    int width,
    int height,
    ByteOrderInfo byteOrderInfo,
    AlphaInfo alphaInfo,
    int componentsPerPixel,
    float physicalWidth,
    Action<IARReferenceImage> completionHandler,
    Orientation orientation = Orientation.Up
)

Creates a new reference image from raw image buffer (RGBA, BGRA, etc), physical size, and orientation in an async manner.

Note

Not supported in Editor.

Note

The ARReferenceImage will contain the full image buffer until it is destroyed. Unless reuse of the constructed ARReferenceImage is required in the near future, it is recommended to destroy images after adding them to a configuration.

Note

Currently, only Orientation.Up is supported

Note

May execute the handler with a null object if creation fails

Parameters:

name

The name of the image (for identifying unique images upon detection)

rawBytes

The base image from which to create the reference image

width

The width of the image in pixels

height

The height of the image in pixels

byteOrderInfo

The endianness of each pixel (See ByteOrderInfo)

alphaInfo

The location of the alpha channel in each pixel (See AlphaInfo)

physicalWidth

The physical width of the image in meters.

completionHandler

The action to run upon creating the image

orientation

The orientation of the provided image. (See Orientation for more information)

static void CreateAsync(
    string name,
    byte[] rawBytesOfJpg,
    int bufferSize,
    float physicalWidth,
    Action<IARReferenceImage> completionHandler,
    Orientation orientation = Orientation.Up
)

Creates a new reference image from the contents of a JPG image (in byte[] form), physical size, and orientation in an async manner.

Note

Not supported in Editor.

Note

The ARReferenceImage will contain the full image buffer until it is destroyed. Unless reuse of the constructed ARReferenceImage is required in the near future, it is recommended to destroy images after adding them to a configuration.

Note

WARNING: JPG decompression contains a security vulnerability, only use this constructor on a byte buffer that can be verified to be a JPG image (manually uploaded data, server verification, etc).

Note

May execute the handler with a null object if creation fails

Parameters:

name

The name of the image (for identifying unique images upon detection)

rawBytes

The JPG image from which to create the reference image

physicalWidth

The physical width of the image in meters.

completionHandler

The action to run upon creating the image

orientation

The orientation of the image (Currently only Up is supported)

static void CreateAsync(
    string name,
    string filePath,
    float physicalWidth,
    Action<IARReferenceImage> completionHandler,
    Orientation orientation = Orientation.Up
)

Creates a new reference image from a JPG file and the physical width in an async manner.

Note

Not supported in Editor.

Note

The ARReferenceImage will contain the full image buffer until it is destroyed. Unless reuse of the constructed ARReferenceImage is required in the near future, it is recommended to destroy images after adding them to a configuration.

Note

WARNING: JPG decompression contains a security vulnerability, only use this constructor on a file that can be verified to be a JPG image (manually uploaded data, server verification, etc).

Note

May execute the handler with a null object if creation fails

Parameters:

name

The name of the image (for identifying unique images upon detection)

filePath

The JPG image from which to create the reference image

physicalWidth

The physical width of the image in meters.

completionHandler

The action to run upon creating the image

orientation

The orientation of the image (Currently only Up is supported)