MaxstAR Native Android  5.0.2
List of all members | Public Member Functions | Static Public Member Functions
com.maxst.ar.CameraDevice Class Reference

Description

CameraDevice class controls the camera device.

Public Member Functions

void setCameraApi (CameraApi cameraApi)
 Select a camera API. More...
 
CameraApi getCameraApi ()
 Get the current camera API. More...
 
ResultCode start (int cameraId, int width, int height)
 Start a camera preview. More...
 
ResultCode stop ()
 Stop a camera preview. More...
 
boolean setZoom (int zoomScale)
 Set a camera zoom scale. More...
 
int getMaxZoomValue ()
 Get the maximum zoom-in value supporting the camera device. More...
 
boolean setFlashLightMode (boolean toggle)
 
void flipVideo (FlipDirection direction, boolean toggle)
 Flip the video background with respect to the given direction. More...
 
boolean isVideoFlipped (FlipDirection direction)
 Get a boolean value representing whether the video background is flipped with respect to the given direction. More...
 
float[] getProjectionMatrix ()
 Get a projection matrix for rendering 3d virtual objects. More...
 
float[] getBackgroundPlaneInfo ()
 Get the coordinates of the background plane where a camera image is rendered. More...
 
void setARCoreTexture ()
 Assign a texture to ARCore to get its camera image. More...
 

Static Public Member Functions

static CameraDevice getInstance ()
 Get the singleton instance of CameraDevice class. More...
 

Member Function Documentation

◆ flipVideo()

void com.maxst.ar.CameraDevice.flipVideo ( FlipDirection  direction,
boolean  toggle 
)

Flip the video background with respect to the given direction.

Parameters
directionthe direction to be flipped.
truefor flipping, false for undoing

◆ getBackgroundPlaneInfo()

float [] com.maxst.ar.CameraDevice.getBackgroundPlaneInfo ( )

Get the coordinates of the background plane where a camera image is rendered.

Returns
the coordinates of the background plane

◆ getCameraApi()

CameraApi com.maxst.ar.CameraDevice.getCameraApi ( )

Get the current camera API.

Returns
CameraApi enumerator value

◆ getInstance()

static CameraDevice com.maxst.ar.CameraDevice.getInstance ( )
static

Get the singleton instance of CameraDevice class.

Returns
the singleton instance of CameraDevice class.

◆ getMaxZoomValue()

int com.maxst.ar.CameraDevice.getMaxZoomValue ( )

Get the maximum zoom-in value supporting the camera device.

Returns
the maximum zoom-in value.

◆ getProjectionMatrix()

float [] com.maxst.ar.CameraDevice.getProjectionMatrix ( )

Get a projection matrix for rendering 3d virtual objects.

MAXST AR obeys the right-handed coordinated system same as OpenGL.

Returns
a 4x4 projection matrix stored in column-major order.

◆ isVideoFlipped()

boolean com.maxst.ar.CameraDevice.isVideoFlipped ( FlipDirection  direction)

Get a boolean value representing whether the video background is flipped with respect to the given direction.

Parameters
directionthe direction
Returns
true if the video background is flipped with respect to the given direction.

◆ setARCoreTexture()

void com.maxst.ar.CameraDevice.setARCoreTexture ( )

Assign a texture to ARCore to get its camera image.

◆ setCameraApi()

void com.maxst.ar.CameraDevice.setCameraApi ( CameraApi  cameraApi)

Select a camera API.

Parameters
cameraApirefers to CameraApi enumerator.

◆ setFlashLightMode()

boolean com.maxst.ar.CameraDevice.setFlashLightMode ( boolean  toggle)

Turn on a flash light, or not.

Parameters
truefor turning the light on, otherwise false.
Returns
true if setting is successful.

◆ setZoom()

boolean com.maxst.ar.CameraDevice.setZoom ( int  zoomScale)

Set a camera zoom scale.

Parameters
zoomScalea zoom value
Returns
true if setting is successful.

◆ start()

ResultCode com.maxst.ar.CameraDevice.start ( int  cameraId,
int  width,
int  height 
)

Start a camera preview.

After an AR tracker starts, camera frames is sequentially sent to the AR tracker. This method gets preferable camera width and height as parameters. If the camera device does not support the exact width and height, the most similar width and height are chosen.

Parameters
cameraId0 is a rear camera, 1 is a front camera.
widththe preferable camera width.
heightthe preferable camera height.
Returns
ResultCode concerning camera initialization.

◆ stop()

ResultCode com.maxst.ar.CameraDevice.stop ( )

Stop a camera preview.

Returns
ResultCode concerning camera termination.