Packagecom.transmote.flar.source
Classpublic class FLARCameraSource
InheritanceFLARCameraSource Inheritance flash.display.Sprite
Implements IFLARSource

Use the contents of a Camera feed as a source image for tracker target detection.

See also

com.transmote.flar.FLARManager


Public Properties
 PropertyDefined By
  activityThreshold : int
When camera.activityLevel is less than this value, the source will not be sent to FLARToolkit.
FLARCameraSource
  cameraIndex : int
The index, in Camera.names, of the active camera.
FLARCameraSource
  inited : Boolean
[read-only] Returns true if initialization is complete.
FLARCameraSource
  mirrored : Boolean
Set to true to flip the camera image horizontally.
FLARCameraSource
  source : BitmapData
[read-only] Retrieve the BitmapData source used for analysis.
FLARCameraSource
  sourceDirty : Boolean
[read-only] Returns true if the camera view has changed more than activityThreshold this frame.
FLARCameraSource
  sourceSize : Rectangle
[read-only] Size of BitmapData source used for analysis.
FLARCameraSource
  trackerToDisplayRatio : Number
[read-only] Ratio of area of tracker's reported results to display size.
FLARCameraSource
  useDefaultCamera : Boolean
If true, FLARCameraSource will use the default camera, acquired via a Camera.getCamera() with no parameters.
FLARCameraSource
Public Methods
 MethodDefined By
  
Constructor.
FLARCameraSource
  
dispose():void
Halts all processes and frees this instance for garbage collection.
FLARCameraSource
  
init(captureWidth:int = 320, captureHeight:int = 240, fps:Number = 30, mirrored:Boolean = true, displayWidth:int = -1, displayHeight:int = -1, trackerToSourceRatio:Number = 0.5, activityThreshold:int = 0):void
Initialize this FLARCameraSource.
FLARCameraSource
  
update():void
Update the BitmapData source.
FLARCameraSource
  
validateCamera(bSuppressReinit:Boolean = false):Boolean
Validate that the selected Camera is active, by checking Camera.activityLevel.
FLARCameraSource
Property Detail
activityThresholdproperty
activityThreshold:int

When camera.activityLevel is less than this value, the source will not be sent to FLARToolkit. This freezes the marker in place when there is very little motion.

Defaults to 16; valid values range from 0 (no suppression) to 100 (full suppression). Set higher to further reduce jitter in stationary markers, and set lower to allow more freedom of motion with stationary markers.

Thanks to Deepanjan Das for this idea: http://deepanjandas.wordpress.com/2010/07/08/augmented-reality-using-flartoolkit-restrict-unnecessary-model-jumping/


Implementation
    public function get activityThreshold():int
    public function set activityThreshold(value:int):void
cameraIndexproperty 
cameraIndex:int

The index, in Camera.names, of the active camera. If no camera is currently active, returns -1. Setting this value will destroy any active camera, and reinitialize with the camera at the specified index.


Implementation
    public function get cameraIndex():int
    public function set cameraIndex(value:int):void
initedproperty 
inited:Boolean  [read-only]

Returns true if initialization is complete.


Implementation
    public function get inited():Boolean
mirroredproperty 
mirrored:Boolean

Set to true to flip the camera image horizontally.


Implementation
    public function get mirrored():Boolean
    public function set mirrored(value:Boolean):void
sourceproperty 
source:BitmapData  [read-only]

Retrieve the BitmapData source used for analysis. NOTE: returns the actual BitmapData object, not a clone.


Implementation
    public function get source():BitmapData
sourceDirtyproperty 
sourceDirty:Boolean  [read-only]

Returns true if the camera view has changed more than activityThreshold this frame.


Implementation
    public function get sourceDirty():Boolean
sourceSizeproperty 
sourceSize:Rectangle  [read-only]

Size of BitmapData source used for analysis.


Implementation
    public function get sourceSize():Rectangle
trackerToDisplayRatioproperty 
trackerToDisplayRatio:Number  [read-only]

Ratio of area of tracker's reported results to display size. Use to scale (multiply) results of tracker analysis to correctly fit display area.


Implementation
    public function get trackerToDisplayRatio():Number
useDefaultCameraproperty 
useDefaultCamera:Boolean

If true, FLARCameraSource will use the default camera, acquired via a Camera.getCamera() with no parameters. If false (the default), FLARCameraSource will loop through the camera drivers available on the system until it finds one that reports activity.


Implementation
    public function get useDefaultCamera():Boolean
    public function set useDefaultCamera(value:Boolean):void
Constructor Detail
FLARCameraSource()Constructor
public function FLARCameraSource()

Constructor.

Method Detail
dispose()method
public function dispose():void

Halts all processes and frees this instance for garbage collection.

init()method 
public function init(captureWidth:int = 320, captureHeight:int = 240, fps:Number = 30, mirrored:Boolean = true, displayWidth:int = -1, displayHeight:int = -1, trackerToSourceRatio:Number = 0.5, activityThreshold:int = 0):void

Initialize this FLARCameraSource.

Parameters

captureWidth:int (default = 320) — Width at which to capture video.
 
captureHeight:int (default = 240) — Height at which to capture video.
 
fps:Number (default = 30) — Framerate of camera capture.
 
mirrored:Boolean (default = true) — If true, video is flipped horizontally.
 
displayWidth:int (default = -1) — Width at which to display video.
 
displayHeight:int (default = -1) — Height at which to display video.
 
trackerToSourceRatio:Number (default = 0.5) — Amount to downsample camera input. The captured video is scaled down by this value before being sent to tracker for analysis. Trackers run faster with more downsampling, but also have more difficulty recognizing marker patterns and targets. A value of 1.0 results in no downsampling; A value of 0.5 (the default) downsamples the camera input by half.
 
activityThreshold:int (default = 0)


Throws
Error If — no camera is found. (Thrown by initCamera, called from this method.)
update()method 
public function update():void

Update the BitmapData source.

validateCamera()method 
public function validateCamera(bSuppressReinit:Boolean = false):Boolean

Validate that the selected Camera is active, by checking Camera.activityLevel. If camera is not active, FLARCameraSource attempts to reinitialize with next available camera.

Parameters

bSuppressReinit:Boolean (default = false) — If false (default), this method will reinitialize the camera with the next available camera.

Returns
Boolean — true If selected Camera is active (activityLevel != -1).