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

Use the contents of a Camera feed as a source image for FLARToolkit marker detection.

See also

../../flar/FLARManager.html


Public Properties
 PropertyDefined by
  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
  resultsToDisplayRatio : Number
[read-only] ratio of area of reported results to display size.
FLARCameraSource
  source : BitmapData
[read-only] retrieve the BitmapData source used for analysis.
FLARCameraSource
  sourceSize : Rectangle
[read-only] size of BitmapData source used for analysis.
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, downsampleRatio:Number = 0.5):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
cameraIndexproperty
cameraIndex:int  [read-write]

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  [read-write]

set to true to flip the camera image horizontally.

Implementation
    public function get mirrored():Boolean
    public function set mirrored(value:Boolean):void
resultsToDisplayRatioproperty 
resultsToDisplayRatio:Number  [read-only]

ratio of area of reported results to display size. use to scale (multiply) results of FLARToolkit analysis to correctly fit display area.

Implementation
    public function get resultsToDisplayRatio():Number
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
sourceSizeproperty 
sourceSize:Rectangle  [read-only]

size of BitmapData source used for analysis.

Implementation
    public function get sourceSize():Rectangle
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, downsampleRatio:Number = 0.5):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.
 
downsampleRatio:Number (default = 0.5) — amount to downsample camera input. The captured video is scaled down by this value before being sent to FLARToolkit for analysis. FLARToolkit runs faster with more downsampling, but also has more difficulty recognizing marker patterns. a value of 1.0 results in no downsampling; a value of 0.5 (the default) downsamples the camera input by half.

Throws
— if no camera is found. (thrown by this.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).