Packagemetaio.camera
Classpublic class ARCamera
InheritanceARCamera Inheritance flash.display.Sprite

The class ARCamera abstracts the camera, and provides functionality as needed for tracking, e.g. frame grabbing. Furthermore it is a sprite so it can added to stage for displaying camera video stream.



Public Methods
 MethodDefined By
  
ARCamera(trackWidth:int, trackHeight:int, videoWidth:int, videoHeight:int, fps:Number)
First camera setup
ARCamera
  
Activates the first camera found.
ARCamera
  
activateCameraByIndex(cameraIdx:int = 0):void
Activates the camera.
ARCamera
  
activateCameraByName(cameraName:String = null):void
Activates the camera.
ARCamera
  
Get camera resolution.
ARCamera
  
Retrieve the list of available cameras
ARCamera
  
Get camera resolution.
ARCamera
  
Get the number of channels of frame as returned by getCurrentFrame() methods.
ARCamera
  
Get current Camera object
ARCamera
  
getCurrentFrame(flip:Boolean = false):ByteArray
Grab current frame from the camera This function is usually used for tracking.
ARCamera
  
Get the vertical resolution of images passed to tracking system.
ARCamera
  
Get the horizontal resolution of images passed to tracking system.
ARCamera
  
getVideo():Video
Get the video object of the camera
ARCamera
  
isInitialized():Boolean
Get current initialization state of the camera.
ARCamera
  
setMirrorMode(mirrored:Boolean):void
Sets the mirror-mode of the camera image on the stage.
ARCamera
  
setVideoSmoothing(smooth:Boolean):void
Enable video smoothing when displaying the camera video stream.
ARCamera
Constructor Detail
ARCamera()Constructor
public function ARCamera(trackWidth:int, trackHeight:int, videoWidth:int, videoHeight:int, fps:Number)

First camera setup

Parameters
trackWidth:int — is the width of frame which will be passed to tracking
 
trackHeight:int — is the height of frame which will be passed to tracking
 
videoWidth:int — is the horizontal resolution of the camera stream
 
videoHeight:int — is the vertical resolution of the camera stream
 
fps:Number — Application Framerate
Method Detail
activateCamera()method
public function activateCamera():void

Activates the first camera found. This can not be done automatically in the Constructor or an error can't be properly reported to the main application (through events).

activateCameraByIndex()method 
public function activateCameraByIndex(cameraIdx:int = 0):void

Activates the camera. This can not be done automatically in the Constructor or an error can't be properly reported to the main application (through events).

Parameters

cameraIdx:int (default = 0) — is the index of the camera in the camera list (as String) as returned by getCameraList(). If not set then the camera will be choosen automatically

activateCameraByName()method 
public function activateCameraByName(cameraName:String = null):void

Activates the camera. This can not be done automatically in the Constructor or an error can't be properly reported to the main application (through events).

Parameters

cameraName:String (default = null) — cameraName Name of the camera as given by getCameraList. If not set the camera will be choosen automatically.

getCameraHeight()method 
public function getCameraHeight():int

Get camera resolution.

Returns
int — The height of the camera stream.
getCameraList()method 
public function getCameraList():Array

Retrieve the list of available cameras

Returns
Array — Array whith names of available cameras
getCameraWidth()method 
public function getCameraWidth():int

Get camera resolution.

Returns
int — The width of the camera stream.
getChannels()method 
public function getChannels():int

Get the number of channels of frame as returned by getCurrentFrame() methods.

Returns
int — Number of channels.
getCurrentCamera()method 
public function getCurrentCamera():Camera

Get current Camera object

Returns
Camera — Current camera object is camera is choosen, null otherwise
getCurrentFrame()method 
public function getCurrentFrame(flip:Boolean = false):ByteArray

Grab current frame from the camera This function is usually used for tracking. The function returns the actual frame in camera's native resolution (not scaled or filtered). The flip-paramter works independently of the mirror-mode. The flipping relates to the raw camera image.

Parameters

flip:Boolean (default = false) — if set to true returned frame will be horizontally flipped, independently of the mirror-mode.

Returns
ByteArray — Current camera frame as bytearray
getTrackingHeight()method 
public function getTrackingHeight():int

Get the vertical resolution of images passed to tracking system. Usually it is lower than the camera resolution.

Returns
int — The vertical resolution.
getTrackingWidth()method 
public function getTrackingWidth():int

Get the horizontal resolution of images passed to tracking system. Usually it is lower than the camera resolution.

Returns
int — The horizontal resolution.
getVideo()method 
public function getVideo():Video

Get the video object of the camera

Returns
Video
isInitialized()method 
public function isInitialized():Boolean

Get current initialization state of the camera.

Returns
Boolean — True if camera is initialized, otherwise false
setMirrorMode()method 
public function setMirrorMode(mirrored:Boolean):void

Sets the mirror-mode of the camera image on the stage. - true: The visual camera image is flipped, so that one would look into a mirror, if the camera is mounted on top of the screen. - false: The camera image is not flipped. Good for see-through applications.

Parameters

mirrored:Boolean — True, the camera image is mirrored, otherwise not.

setVideoSmoothing()method 
public function setVideoSmoothing(smooth:Boolean):void

Enable video smoothing when displaying the camera video stream.

Parameters

smooth:Boolean — set to true in order to enable smoothing.