public final class ARReferenceImage
- Object
- ARReferenceImage
A 2D image the AR session should recognize in the real world - a poster, a
game board, a product label. Register reference images through
ARSessionOptions#referenceImages(ARReferenceImage[]); when the camera
sees one, the session delivers an ARImageAnchor carrying this image’s
name.
The physical width tells the platform how large the printed image is in the real world, which it needs to estimate the image’s distance and pose accurately.
Constructors
public ARReferenceImage(String name, byte[] encodedImage, float physicalWidthMeters) | Creates a reference image from encoded (PNG or JPEG) bytes. |
public ARReferenceImage(String name, Image image, float physicalWidthMeters) | Creates a reference image from an Image, encoding it as PNG. |
Methods
public String getName() | The unique name identifying this image. |
public byte[] getEncodedImage() | The encoded (PNG or JPEG) bytes of the image as a newly allocated array. |
public float getPhysicalWidthMeters() | The width of the printed image in meters. |
Inherited methods
Constructor details
ARReferenceImage
public ARReferenceImage(String name, byte[] encodedImage, float physicalWidthMeters)Creates a reference image from encoded (PNG or JPEG) bytes.
Parameters
nameString- a unique name identifying this image in
ARImageAnchors encodedImagebyte[]- the PNG or JPEG bytes of the image to detect
physicalWidthMetersfloat- the width of the printed image in meters
ARReferenceImage
public ARReferenceImage(String name, Image image, float physicalWidthMeters)Creates a reference image from an
Image, encoding it as PNG.Parameters
nameString- a unique name identifying this image in
ARImageAnchors imageImage- the image to detect
physicalWidthMetersfloat- the width of the printed image in meters
Method details
getName
public String getName()The unique name identifying this image.
getEncodedImage
public byte[] getEncodedImage()The encoded (PNG or JPEG) bytes of the image as a newly allocated
array.
getPhysicalWidthMeters
public float getPhysicalWidthMeters()The width of the printed image in meters.