Package | com.transmote.flar |
Class | public class FLARManager |
Inheritance | FLARManager 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. Alternatively, FLARManager can be initialized using an xml file that specifies the above and other settings.
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.
See also
Property | Defined 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 | ||
isActive : Boolean
true if this FLARManager instance is active and currently processing marker detection.
| FLARManager | ||
markerRemovalDelay : int
number of frames after removal that a marker will persist before dispatching a MARKER_REMOVED event.
| FLARManager | ||
markerUpdateThreshold : Number
if a detected marker is within this distance (pixels) from an active marker,
FLARManager considers the detected marker to be an update of the active marker.
| FLARManager | ||
minimumLabelSize : Number
provides direct access to FLARLabeling_BitmapData.minimumLabelSize,
which is the minimum size (widtheight) a dark area of the source image must be
in order to become a candidate for marker outline detection.
| 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 | ||
sampleBlurring : int
the amount of blur applied to the source image
before sending to FLARToolkit for marker 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 : int
pixels in source image with a brightness <= to this.threshold are candidates for marker outline detection.
| FLARManager | ||
thresholdAdapter : IThresholdAdapter
IFLARThresholdAdapter used to automate threshold changes.
| FLARManager | ||
thresholdSourceDisplay : Boolean
display the source BitmapData used by FLARToolkit post-thresholding.
| FLARManager | ||
verbose : Boolean
if true, FLARManager will output configuration changes to the console.
| FLARManager |
Method | Defined by | ||
---|---|---|---|
FLARManager(flarConfigPath:String = "")
Constructor.
| FLARManager | ||
activate():Boolean
begin detecting markers once per frame.
| FLARManager | ||
deactivate():void
stop detecting markers.
| FLARManager | ||
dispose():void
halts all processes and frees this instance for garbage collection.
| FLARManager | ||
initFromFile(flarConfigPath:String):void
load FLARManager configuration from an xml file.
| FLARManager | ||
initFromXML(flarConfigXML:XML):void
init from an XML object in Flash.
| FLARManager | ||
initManual(cameraParamsPath:String, patterns:Vector, source:IFLARSource = null):void
the old-fashioned way to initialize FLARManager.
| FLARManager |
activeMarkers | property |
activeMarkers:Vector
[read-only]Vector of all currently-active markers.
Implementation public function get activeMarkers():Vector
cameraParams | property |
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
flarSource | property |
flarSource:IFLARSource
[read-only]IFLARSource instance this FLARManager is using as the source image for marker detection.
Implementation public function get flarSource():IFLARSource
isActive | property |
isActive:Boolean
[read-write]true if this FLARManager instance is active and currently processing marker detection.
Implementation public function get isActive():Boolean
public function set isActive(value:Boolean):void
markerRemovalDelay | property |
markerRemovalDelay:int
[read-write]number of frames after removal that a marker will persist before dispatching a MARKER_REMOVED event. if a marker of the same pattern appears within markerUpdateThreshold pixels of the point of removal, before markerRemovalDelay frames have elapsed, the marker will be reinstated as if it was never removed. the default value is 1.
Implementation public function get markerRemovalDelay():int
public function set markerRemovalDelay(value:int):void
markerUpdateThreshold | property |
markerUpdateThreshold:Number
[read-write]if a detected marker is within this distance (pixels) 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. increase this value to accommodate faster-moving markers; decrease it to accommodate more markers on-screen at once.
Implementation public function get markerUpdateThreshold():Number
public function set markerUpdateThreshold(value:Number):void
minimumLabelSize | property |
minimumLabelSize:Number
[read-write]provides direct access to FLARLabeling_BitmapData.minimumLabelSize, which is the minimum size (widtheight) a dark area of the source image must be in order to become a candidate for marker outline detection. higher values result in faster performance, but poorer marker detection at smaller sizes (as they appear on-screen). defaults to 100.
Implementation public function get minimumLabelSize():Number
public function set minimumLabelSize(value:Number):void
mirrorDisplay | property |
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
numLoadedPatterns | property |
numLoadedPatterns:int
[read-only]the number of patterns loaded for detection.
Implementation public function get numLoadedPatterns():int
sampleBlurring | property |
sampleBlurring:int
[read-write]the amount of blur applied to the source image before sending to FLARToolkit for marker detection. higher values increase framerate, but reduce detection accuracy. value must be zero or greater. the default value is 2.
Implementation public function get sampleBlurring():int
public function set sampleBlurring(value:int):void
smoother | property |
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
smoothing | property |
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
threshold | property |
threshold:int
[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():int
public function set threshold(value:int):void
thresholdAdapter | property |
thresholdAdapter:IThresholdAdapter
[read-write]IFLARThresholdAdapter used to automate threshold changes. adaptive thresholding can result in better marker detection across a range of illumination. this is desirable for applications with low lighting, or in which the developer has little control over lighting conditions, such as with web applications. note that adaptive thresholding may cause slower performance in very dark environments. this happens because a low threshold creates an image with large black areas, and images with a lot of black can cause slowdown in FLARToolkit's labeling process (FLARLabeling_BitmapData.labeling()). in this case, thresholdAdapter should be set to null. the default threshold adapter is DrunkWalkThresholdAdapter, but developers can implement their own algorithms for adaptive thresholding. to do so, implement the IThresholdAdapter interface.
Implementation public function get thresholdAdapter():IThresholdAdapter
public function set thresholdAdapter(value:IThresholdAdapter):void
thresholdSourceDisplay | property |
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
verbose | property |
verbose:Boolean
[read-write]if true, FLARManager will output configuration changes to the console.
Implementation public function get verbose():Boolean
public function set verbose(value:Boolean):void
FLARManager | () | constructor |
public function FLARManager(flarConfigPath:String = "")
Constructor. Initialize FLARManager by passing in a configuration file path.
ParametersflarConfigPath:String (default = " ") — path to the FLARManager configuration xml file.
|
activate | () | method |
public function activate():Boolean
begin detecting markers once per frame. this method is called automatically on initialization.
ReturnsBoolean — false if FLARManager is not yet initialized; else true.
|
deactivate | () | method |
public function deactivate():void
stop detecting markers. removes all currently-active markers. enterframe loop continues, to update video.
dispose | () | method |
public function dispose():void
halts all processes and frees this instance for garbage collection.
initFromFile | () | method |
public function initFromFile(flarConfigPath:String):void
load FLARManager configuration from an xml file. note, this method no longer needs to be called manually; simply passing the configuration file path into the constructor will also initialize correctly. this method is here for legacy support only.
ParametersflarConfigPath:String — path to the FLARManager configuration xml file.
|
initFromXML | () | method |
public function initFromXML(flarConfigXML:XML):void
init from an XML object in Flash. this can be useful when dynamically generating an XML file at runtime, such as via a middleware request.
ParametersflarConfigXML:XML |
initManual | () | method |
public function initManual(cameraParamsPath:String, patterns:Vector, source:IFLARSource = null):void
the old-fashioned way to initialize FLARManager. the preferred method is to use an external xml configuration file, and to pass its path into the FLARManager constructor.
ParameterscameraParamsPath:String — camera parameters filename.
|
|
patterns:Vector — list of FLARPatterns to detect.
|
|
source:IFLARSource (default = null ) — IFLARSource instance to use as source image for marker detection.
if null, FLARManager will create a camera capture source.
|