Packagecom.transmote.flar
Classpublic class FLARManager
InheritanceFLARManager Inheritance flash.events.EventDispatcher

manager for computer vision applications using FLARToolkit (http://www.libspark.org/wiki/saqoosha/FLARToolKit/en). basic usage is as follows: pass a path to a camera parameters file and a list of FLARPatterns to the constructor. optionally pass an IFLARSource to use as the source image for marker detection; FLARManager will by default create a FLARCameraSource that uses the first available camera. assign event listeners to FLARManager for MARKER_ADDED, MARKER_UPDATED, and MARKER_REMOVED FLARMarkerEvents. these FLARMarkerEvents encapsulate the FLARMarker instances that they refer to. alternatively, it is possible to retrieve all active markers directly from FLARManager, via FLARManager.activeMarkers. FLARMarkers are simple objects that contain information about detected markers provided by FLARToolkit. FLARManager maintains a list of active markers, and updates the list and the markers within every frame.



Public Properties
 PropertyDefined by
  activeMarkers : Vector
[read-only] Vector of all currently-active markers.
FLARManager
  cameraParams : FLARParam
[read-only] FLARParam used by this FLARManager.
FLARManager
  flarSource : IFLARSource
[read-only] IFLARSource instance this FLARManager is using as the source image for marker detection.
FLARManager
  markerUpdateThreshold : Number
if a detected marker is within this distance from an active marker, FLARManager considers the detected marker to be an update of the active marker.
FLARManager
  mirrorDisplay : Boolean
set to true to flip the camera image horizontally; this value is passed on to this.flarSource; note that if an IFLARSource is specified after mirrorDisplay is set, the 'mirrored' property of the new IFLARSource will overwrite this value.
FLARManager
  numLoadedPatterns : int
[read-only] the number of patterns loaded for detection.
FLARManager
  smoother : IFLARMatrixSmoother
IFLARMatrixSmoother to use to apply smoothing to transformation matrices generated by FLARToolkit.
FLARManager
  smoothing : int
apply a smoothing algorithm to transformation matrices generated by FLARToolkit.
FLARManager
  threshold : uint
pixels in source image with a brightness <= to this.threshold are candidates for marker outline detection.
FLARManager
  thresholdSourceDisplay : Boolean
display the source BitmapData used by FLARToolkit post-thresholding.
FLARManager
Public Methods
 MethodDefined by
  
FLARManager(source:IFLARSource = null, cameraParamsPath:String = "", patterns:Vector = null)
Constructor.
FLARManager
  
activate():Boolean
begin detecting markers once per frame.
FLARManager
  
deactivate():void
stop detecting markers.
FLARManager
  
initFromFile(flarConfigPath:String):void
load FLARManager configuration from an xml file.
FLARManager
Property detail
activeMarkersproperty
activeMarkers:Vector  [read-only]

Vector of all currently-active markers.

Implementation
    public function get activeMarkers():Vector
cameraParamsproperty 
cameraParams:FLARParam  [read-only]

FLARParam used by this FLARManager. can be used to instantiate a FLARCamera3D for use with Papervision.

Implementation
    public function get cameraParams():FLARParam
flarSourceproperty 
flarSource:IFLARSource  [read-only]

IFLARSource instance this FLARManager is using as the source image for marker detection.

Implementation
    public function get flarSource():IFLARSource
markerUpdateThresholdproperty 
markerUpdateThreshold:Number  [read-write]

if a detected marker is within this distance from an active marker, FLARManager considers the detected marker to be an update of the active marker. else, the detected marker is a new marker.

Implementation
    public function get markerUpdateThreshold():Number
    public function set markerUpdateThreshold(value:Number):void
mirrorDisplayproperty 
mirrorDisplay:Boolean  [read-write]

set to true to flip the camera image horizontally; this value is passed on to this.flarSource; note that if an IFLARSource is specified after mirrorDisplay is set, the 'mirrored' property of the new IFLARSource will overwrite this value.

Implementation
    public function get mirrorDisplay():Boolean
    public function set mirrorDisplay(value:Boolean):void
numLoadedPatternsproperty 
numLoadedPatterns:int  [read-only]

the number of patterns loaded for detection.

Implementation
    public function get numLoadedPatterns():int
smootherproperty 
smoother:IFLARMatrixSmoother  [read-write]

IFLARMatrixSmoother to use to apply smoothing to transformation matrices generated by FLARToolkit.

Implementation
    public function get smoother():IFLARMatrixSmoother
    public function set smoother(value:IFLARMatrixSmoother):void
smoothingproperty 
smoothing:int  [read-write]

apply a smoothing algorithm to transformation matrices generated by FLARToolkit. smoothing is equal to the number of frames over which FLARManager will average transformation matrices; the larger the number, the smoother the animation, and the slower the response time between marker position/orientation changes. a value of 0 turns smoothing off.

Implementation
    public function get smoothing():int
    public function set smoothing(value:int):void
thresholdproperty 
threshold:uint  [read-write]

pixels in source image with a brightness <= to this.threshold are candidates for marker outline detection. increase to increase likelihood of marker detection; increasing too high will cause engine to incorrectly detect non-existent markers. defaults to 80 (values can range from 0 to 255).

Implementation
    public function get threshold():uint
    public function set threshold(value:uint):void
thresholdSourceDisplayproperty 
thresholdSourceDisplay:Boolean  [read-write]

display the source BitmapData used by FLARToolkit post-thresholding. useful for debugging.

Implementation
    public function get thresholdSourceDisplay():Boolean
    public function set thresholdSourceDisplay(value:Boolean):void
Constructor detail
FLARManager()constructor
public function FLARManager(source:IFLARSource = null, cameraParamsPath:String = "", patterns:Vector = null)

Constructor. FLARManager can be initialized either by passing in the camera parameters file path and a list of FLARPattern instances, or by specifying a config file path to FLARManager.initFromFile.

Parameters
source:IFLARSource (default = null) — IFLARSource instance to use as source image for marker detection. if null, FLARManager will create a camera capture source.
 
cameraParamsPath:String (default = "") — camera parameters filename.
 
patterns:Vector (default = null) — list of FLARPatterns to detect.
Method detail
activate()method
public function activate():Boolean

begin detecting markers once per frame. this method is called automatically on initialization.

Returns
Boolean — false if FLARManager is not yet initialized; else true.
deactivate()method 
public function deactivate():void

stop detecting markers.

initFromFile()method 
public function initFromFile(flarConfigPath:String):void

load FLARManager configuration from an xml file. this is the preferred method of FLARManager instantiation.

Parameters
flarConfigPath:String — path to the FLARManager configuration xml file.