Image

Provides access to metadata from the camera image capture result.

Summary

Enumerations

ArImageFormat{
  AR_IMAGE_FORMAT_INVALID = 0,
  AR_IMAGE_FORMAT_YUV_420_888 = 0x23,
  AR_IMAGE_FORMAT_RGBA_FP16 = 0x16
}
enum
Image formats produced by ARCore.

Typedefs

AImage typedef
struct AImage
Forward declaring the AImage struct from Android NDK, which is used in ArImage_getNdkImage().
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.
ArImageMetadata typedef
struct ArImageMetadata_
Camera capture metadata (reference type, large data).

Functions

ArImageMetadata_getNdkCameraMetadata(const ArSession *session, const ArImageMetadata *image_metadata, const ACameraMetadata **out_ndk_metadata)
void
Retrieves the capture metadata for the current camera image.
ArImageMetadata_release(ArImageMetadata *metadata)
void
Releases a reference to the metadata.
ArImage_getFormat(const ArSession *session, const ArImage *image, ArImageFormat *out_format)
void
Gets the image format of the input ArImage.
ArImage_getHeight(const ArSession *session, const ArImage *image, int32_t *out_height)
void
Gets the height of the input ArImage.
ArImage_getNdkImage(const ArImage *image, const AImage **out_ndk_image)
void
Deprecated. in release 1.10.0. Please use the other ArImage_* functions to obtain image data. ARCore can produce a wide variety of images, not all of which can be represented using Android NDK AImage provided by this function. In those cases, this method will return nullptr in out_ndk_image.
Converts an ArImage object to an Android NDK AImage object.
ArImage_getNumberOfPlanes(const ArSession *session, const ArImage *image, int32_t *out_num_planes)
void
Gets the number of planes in the input 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 input 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

Typedefs

AImage

struct AImage AImage

Forward declaring the AImage struct from Android NDK, which is used in ArImage_getNdkImage().

ArImage

struct ArImage_ ArImage

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

Acquire with ArFrame_acquireCameraImage()
Convert to NDK AImage with ArImage_getNdkImage()
Release with ArImage_release().

ArImageCubemap

ArImage * ArImageCubemap[6]

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

ArImageMetadata

struct ArImageMetadata_ ArImageMetadata

Camera capture metadata (reference type, large data).

Acquire with ArFrame_acquireImageMetadata()
Release with ArImageMetadata_release()

Functions

ArImageMetadata_getNdkCameraMetadata

void ArImageMetadata_getNdkCameraMetadata(
  const ArSession *session,
  const ArImageMetadata *image_metadata,
  const ACameraMetadata **out_ndk_metadata
)

Retrieves the capture metadata for the current camera image.

ACameraMetadata is a struct in Android NDK. Include NdkCameraMetadata.h to use this type.

Note: that the ACameraMetadata returned from this function will be invalid after its ArImageMetadata object is released.

ArImageMetadata_release

void ArImageMetadata_release(
  ArImageMetadata *metadata
)

Releases a reference to the metadata.

This must match a call to ArFrame_acquireImageMetadata().

This method may safely be called with nullptr - it will do nothing.

ArImage_getFormat

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

Gets the image format of the input 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_getNdkImage

void ArImage_getNdkImage(
  const ArImage *image,
  const AImage **out_ndk_image
)

Converts an ArImage object to an Android NDK AImage object.

The converted image object format is AIMAGE_FORMAT_YUV_420_888.

Deprecated. in release 1.10.0. Please use the other ArImage_* functions to obtain image data. ARCore can produce a wide variety of images, not all of which can be represented using Android NDK AImage provided by this function. In those cases, this method will return nullptr in out_ndk_image.

ArImage_getNumberOfPlanes

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

Gets the number of planes in the input 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 input image for direct application access.

Note that once the ArImage data is released via 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().

Send feedback about...