KudanAR - Android  1.6.0
ARCameraStream Class Reference

Inherits PreviewCallback.

Public Member Functions

void setCameraTransform (float[]transform)
 
float[] getCameraTransform ()
 
ARTexture getTexture ()
 
void setTexture (ARTexture texture)
 
ARCameraTextureMaterial getMaterial ()
 
void setMaterial (ARCameraTextureMaterial material)
 
 ARCameraStream ()
 
void setSurfaceTexture (SurfaceTexture surfaceTexture)
 
void onPreviewFrame (final byte[] data, Camera arg1)
 
void initialise ()
 
void start ()
 
void stop ()
 
int getWidth ()
 
int getHeight ()
 
void rotateCameraPreview (int degrees)
 
void addListener (ARCameraStreamListener listener)
 
void removeListener (ARCameraStreamListener listener)
 
void notifyListenersUpdateFrame (final byte[] data)
 

Static Public Member Functions

static ARCameraStream getInstance ()
 

Public Attributes

ARView mArView
 

Detailed Description

A manager class for handling the camera stream. It has default camera stream dimensions of 640*480.

Constructor & Destructor Documentation

◆ ARCameraStream()

ARCameraStream.ARCameraStream ( )

Initialises the camera stream. This is handled automatically.

Member Function Documentation

◆ addListener()

void ARCameraStream.addListener ( ARCameraStreamListener  listener)

Add ARCameraStreamListener to list of listeners.

Parameters
listener

◆ getCameraTransform()

float [] ARCameraStream.getCameraTransform ( )

Returns the transform of the camera associated with the ARCameraStream as a float array.

Returns
The camera transform of the ARCameraStream.

◆ getHeight()

int ARCameraStream.getHeight ( )

Returns the height of the camera image.

Example of use:

int imageHeight = ARCameraStream.getInstance().getHeight();
Returns
The height of the camera image, in pixels.

◆ getInstance()

static ARCameraStream ARCameraStream.getInstance ( )
static

Gets the instance of the camera stream singleton. The ARCameraStream is initialised when this is first called.

Returns
The singleton instance of the ARCameraStream.

◆ getMaterial()

ARCameraTextureMaterial ARCameraStream.getMaterial ( )

Return the texture material of ARCameraStream.

Returns
ARCameraTextureMaterial

◆ getTexture()

ARTexture ARCameraStream.getTexture ( )

Returns the texture of the ARCameraStream.

Returns
The texture of the current ARCameraStream frame.

◆ getWidth()

int ARCameraStream.getWidth ( )

Returns the width of the camera image.

Returns
The width of the camera image, in pixels.

◆ initialise()

void ARCameraStream.initialise ( )

Initialises ARCameraStream.

◆ notifyListenersUpdateFrame()

void ARCameraStream.notifyListenersUpdateFrame ( final byte[]  data)

Notifies listeners that new frame has been received. Sends camera frame to listeners.

Parameters
dataCamera preview frame.

◆ onPreviewFrame()

void ARCameraStream.onPreviewFrame ( final byte[]  data,
Camera  arg1 
)

Android camera interface method for receiving a camera preview frame.

Parameters
dataAn array of bytes representing the image frame.
arg1Reference to the camera.

◆ removeListener()

void ARCameraStream.removeListener ( ARCameraStreamListener  listener)

Remove ARCameraStreamListener from list of listeners.

Parameters
listener

◆ setCameraTransform()

void ARCameraStream.setCameraTransform ( float[]  transform)

Sets the camera transform of the ARCameraStream. Used to transform from 2d coodinates to texture coordinates.

Example of use:

float[] cameraTransform = mCameraSurfaceTexture.getTransformMatrix(m);
ARCameraStream.getInstance().setCameraTransform(cameraTransform);
Parameters
transformThe float array to set the camera's transform with.

◆ setMaterial()

void ARCameraStream.setMaterial ( ARCameraTextureMaterial  material)

Set ARCameraStream's ARCameraTextureMaterial.

Parameters
material

◆ setSurfaceTexture()

void ARCameraStream.setSurfaceTexture ( SurfaceTexture  surfaceTexture)

Sets SurfaceTexture for ARCameraStream. This is the texture used for the camera preview.

Parameters
surfaceTextureThe SurfaceTexture for ARCameraStream.

◆ setTexture()

void ARCameraStream.setTexture ( ARTexture  texture)

Set the ARCameraStream texture which is updated each frame.

Parameters
texture

◆ start()

void ARCameraStream.start ( )

Starts the camera stream. This is handled automatically when the ARActivity enters the foreground. This method sets up the camera texture that is drawn to the screen.

◆ stop()

void ARCameraStream.stop ( )

Stops the camera stream input and releases the camera. This is handled automatically when the user leaves the ARActivity.


The documentation for this class was generated from the following file: