Most visited

Recently visited

CameraImageListener

public interface CameraImageListener

com.viro.core.CameraImageListener


CameraImageListener receives a callback each time the AR camera image is updated. This can be used to process camera imagery, for your own purposes, as it is rendered to the device. This listener is installed via setCameraImageListener(ViroContext, CameraImageListener).

Summary

Public methods

abstract void onCameraImageUpdated(ByteBuffer buffer, int width, int height, CameraIntrinsics intrinsics)

Callback invoked when the AR camera image has been updated.

Public methods

onCameraImageUpdated

void onCameraImageUpdated (ByteBuffer buffer, 
                int width, 
                int height, 
                CameraIntrinsics intrinsics)

Callback invoked when the AR camera image has been updated. The updated image is stored in the provided ByteBuffer as RGBA8888 data. The image is of the given width and height. The following code converts the image data to a Bitmap, for example:

 Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
 bitmap.copyPixelsFromBuffer(buffer);
 

It is important to not store the given buffer, as it will be overwritten with new image data when this callback is invoked for the next frame. If you need to preserve the image data, copy it to a separate buffer.

Parameters
buffer ByteBuffer: The buffer containing the RGBA8888 data.

width int: The width of the image.

height int: The height of the image.

intrinsics CameraIntrinsics: The CameraIntrinsics of the device's camera, which describe the camera's physical characteristics.

Hooray!