ArImage

Provides access to CPU camera images.

Summary

Enumerations

ArImageFormat{
  AR_IMAGE_FORMAT_INVALID = 0,
  AR_IMAGE_FORMAT_YUV_420_888 = 0x23,
  AR_IMAGE_FORMAT_DEPTH16 = 0x44363159,
  AR_IMAGE_FORMAT_D_16 = 0x00000030,
  AR_IMAGE_FORMAT_Y8 = 0x20203859,
  AR_IMAGE_FORMAT_RGBA_FP16 = 0x16
}
enum
Image formats produced by ARCore.

Typedefs

ArImage typedef
struct ArImage_
Accessing CPU image from the camera (reference type, large data).
ArImageCubemap[6] typedef
Convenient definition for cubemap image storage where it is a fixed size array of 6 ArImage.

Functions

ArImage_getFormat(const ArSession *session, const ArImage *image, ArImageFormat *out_format)
void
Gets the image format of the provided ArImage.
ArImage_getHeight(const ArSession *session, const ArImage *image, int32_t *out_height)
void
Gets the height of the input ArImage.
ArImage_getNumberOfPlanes(const ArSession *session, const ArImage *image, int32_t *out_num_planes)
void
Gets the number of planes in the provided ArImage.
ArImage_getPlaneData(const ArSession *session, const ArImage *image, int32_t plane_index, const uint8_t **out_data, int32_t *out_data_length)
void
Gets the data pointer of the provided image for direct application access.
ArImage_getPlanePixelStride(const ArSession *session, const ArImage *image, int32_t plane_index, int32_t *out_pixel_stride)
void
Gets the byte distance between the start of two consecutive pixels in the image.
ArImage_getPlaneRowStride(const ArSession *session, const ArImage *image, int32_t plane_index, int32_t *out_row_stride)
void
Gets the number of bytes between the start of two consecutive rows of pixels in the image.
ArImage_getTimestamp(const ArSession *session, const ArImage *image, int64_t *out_timestamp_ns)
void
Gets the source-specific timestamp of the provided ArImage in nanoseconds.
ArImage_getWidth(const ArSession *session, const ArImage *image, int32_t *out_width)
void
Gets the width of the input ArImage.
ArImage_release(ArImage *image)
void
Releases an instance of ArImage returned by ArFrame_acquireCameraImage.

Enumerations

ArImageFormat

 ArImageFormat

Image formats produced by ARCore.

Properties
AR_IMAGE_FORMAT_DEPTH16

Produced by ArFrame_acquireDepthImage and ArFrame_acquireRawDepthImage.

Integer value equal to DEPTH16.

AR_IMAGE_FORMAT_D_16

Produced by ArFrame_acquireDepthImage16Bits and ArFrame_acquireRawDepthImage16Bits.

Depth range values in units of millimeters. Integer value equal to D_16.

AR_IMAGE_FORMAT_INVALID

Invalid image format.

Produced by ARCore when an invalid session/image is given to ArImage_getFormat.

AR_IMAGE_FORMAT_RGBA_FP16

Produced by ArLightEstimate_acquireEnvironmentalHdrCubemap.

Integer value equal to Android NDK AIMAGE_FORMAT_RGBA_FP16.

AR_IMAGE_FORMAT_Y8

Produced by ArFrame_acquireRawDepthConfidenceImage.

Integer value equal to Y8.

AR_IMAGE_FORMAT_YUV_420_888

Produced by ArFrame_acquireCameraImage.

Integer value equal to Android NDK AIMAGE_FORMAT_YUV_420_888 and YUV_420_888.

Typedefs

ArImage

struct ArImage_ ArImage

Accessing CPU image from the camera (reference type, large data).

ArImageCubemap

ArImage * ArImageCubemap[6]

Convenient definition for cubemap image storage where it is a fixed size array of 6 ArImage.

Functions

ArImage_getFormat

void ArImage_getFormat(
  const ArSession *session,
  const ArImage *image,
  ArImageFormat *out_format
)

Gets the image format of the provided ArImage.

Details
Parameters
session
The ARCore session.
image
The ArImage of interest.
out_format
The image format, one of ArImageFormat values.

ArImage_getHeight

void ArImage_getHeight(
  const ArSession *session,
  const ArImage *image,
  int32_t *out_height
)

Gets the height of the input ArImage.

Details
Parameters
session
The ARCore session.
image
The ArImage of interest.
out_height
The height of the image in pixels.

ArImage_getNumberOfPlanes

void ArImage_getNumberOfPlanes(
  const ArSession *session,
  const ArImage *image,
  int32_t *out_num_planes
)

Gets the number of planes in the provided ArImage.

The number of planes and format of data in each plane is format dependent. Use ArImage_getFormat to determine the format.

Details
Parameters
session
The ARCore session.
image
The ArImage of interest.
out_num_planes
The number of planes in the image.

ArImage_getPlaneData

void ArImage_getPlaneData(
  const ArSession *session,
  const ArImage *image,
  int32_t plane_index,
  const uint8_t **out_data,
  int32_t *out_data_length
)

Gets the data pointer of the provided image for direct application access.

Note that once the ArImage data is released with ArImage_release, the data pointer from the corresponding ArImage_getPlaneData call becomes invalid. Do NOT use it after the ArImage is released.

Details
Parameters
session
The ARCore session.
image
The ArImage of interest.
plane_index
The index of the plane, between 0 and n-1, where n is number of planes for this image.
out_data
The data pointer to the image.
out_data_length
The length of data in bytes.

ArImage_getPlanePixelStride

void ArImage_getPlanePixelStride(
  const ArSession *session,
  const ArImage *image,
  int32_t plane_index,
  int32_t *out_pixel_stride
)

Gets the byte distance between the start of two consecutive pixels in the image.

The pixel stride is always greater than 0.

Details
Parameters
session
The ARCore session.
image
The ArImage of interest.
plane_index
The index of the plane, between 0 and n-1, where n is number of planes for this image.
out_pixel_stride
The plane stride of the image in bytes.

ArImage_getPlaneRowStride

void ArImage_getPlaneRowStride(
  const ArSession *session,
  const ArImage *image,
  int32_t plane_index,
  int32_t *out_row_stride
)

Gets the number of bytes between the start of two consecutive rows of pixels in the image.

The row stride is always greater than 0.

Details
Parameters
session
The ARCore session.
image
The ArImage of interest.
plane_index
The index of the plane, between 0 and n-1, where n is number of planes for this image.
out_row_stride
The row stride of the image in bytes.

ArImage_getTimestamp

void ArImage_getTimestamp(
  const ArSession *session,
  const ArImage *image,
  int64_t *out_timestamp_ns
)

Gets the source-specific timestamp of the provided ArImage in nanoseconds.

The timestamp is normally monotonically increasing. The timestamps for the images from different sources may have different timebases and should not be compared with each other. The specific meaning and timebase of the returned timestamp depends on the source providing images.

Details
Parameters
session
The ARCore session.
image
The ArImage of interest.
out_timestamp_ns
The timestamp of the image in nanoseconds.

ArImage_getWidth

void ArImage_getWidth(
  const ArSession *session,
  const ArImage *image,
  int32_t *out_width
)

Gets the width of the input ArImage.

Details
Parameters
session
The ARCore session.
image
The ArImage of interest.
out_width
The width of the image in pixels.

ArImage_release

void ArImage_release(
  ArImage *image
)

Releases an instance of ArImage returned by ArFrame_acquireCameraImage.