Package | com.transmote.flar |
Class | public class FLARManager |
Inheritance | FLARManager flash.events.EventDispatcher |
Basic usage is as follows: Instantiate an IFLARTrackerManager to communicate with the tracking library of your choice. Pass it into the FLARManager constructor, along with a reference to the application Stage and the path to the xml configuration file (by default, flarConfig.xml). For more information about the xml configuration file, please see the online documentation.
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
.
Use FLARMarker's properties along with the appropriate matrix conversion methods in the
com.transmote.flar.utils.geom
package to transform display objects to align with detected markers.
FLARMarker instances contain information about objects detected by the selected tracking library. FLARManager maintains a list of active markers, and updates the list and the markers within every frame.
See also
Property | Defined By | ||
---|---|---|---|
activeMarkers : Vector.<FLARMarker> [read-only]
Vector of all currently-active markers. | FLARManager | ||
adaptiveSmoothingCenter : Number
Adaptive smoothing reduces jitter in marker transformation matrices for markers with
little motion, while maintaining responsiveness for markers with fast motion. | FLARManager | ||
flarCameraSource : FLARCameraSource [read-only]
Reference to FLARCameraSource used in this application. | FLARManager | ||
flarSource : IFLARSource [read-only]
IFLARSource instance FLARManager is using as the source image for marker detection. | FLARManager | ||
inverted : Boolean
Set to true to detect inverted (white border) markers. | FLARManager | ||
isActive : Boolean
true if this FLARManager instance is active and currently performing marker detection. | FLARManager | ||
markerExtrapolation : Boolean
If true, FLARManager will extrapolate the position of a FLARMarker from its velocity when last detected. | 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 | ||
mirrorDisplay : Boolean
Set to true to flip the camera image horizontally;
this value is passed on to this.flarSource. | FLARManager | ||
sampleBlurring : int
The amount of blur applied to the source image
before sending to tracker for image analysis / object detection. | FLARManager | ||
smoother : IFLARMatrixSmoother
IFLARMatrixSmoother to use to apply smoothing to transformation matrices generated by trackerManager. | FLARManager | ||
smoothing : int
Apply a smoothing algorithm to transformation matrices generated by trackerManager. | FLARManager | ||
threshold : int
Threshold applied to BitmapData before tracker analysis. | FLARManager | ||
thresholdAdapter : IThresholdAdapter
IFLARThresholdAdapter used to automate threshold changes. | FLARManager | ||
trackerId : String [read-only]
String id of layer of FLARManager that interfaces with the selected tracking library. | FLARManager | ||
trackerManager : IFLARTrackerManager [read-only]
The layer of FLARManager that interfaces with the selected tracking library. | FLARManager | ||
verbose : Boolean
If true, FLARManager will output configuration changes to the console. | FLARManager | ||
version : String [read-only]
Current version of FLARManager. | FLARManager |
Method | Defined By | ||
---|---|---|---|
FLARManager(flarConfig:*, trackerManager:IFLARTrackerManager, stage:Stage)
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 | ||
getProjectionMatrix(frameworkId:int, viewportSize:Rectangle):Matrix3D
Get tracker projection matrix. | FLARManager |
Constant | Defined By | ||
---|---|---|---|
FRAMEWORK_ID_ALTERNATIVA : int = 2 [static] | FLARManager | ||
FRAMEWORK_ID_AWAY : int = 3 [static] | FLARManager | ||
FRAMEWORK_ID_AWAY_LITE : int = 4 [static] | FLARManager | ||
FRAMEWORK_ID_FLASH : int = 1 [static] | FLARManager | ||
FRAMEWORK_ID_PAPERVISION : int = 5 [static] | FLARManager | ||
FRAMEWORK_ID_SANDY : int = 6 [static] | FLARManager | ||
TRACKER_ID_FLARE : String = FlareManager [static] | FLARManager | ||
TRACKER_ID_FLARE_NFT : String = FlareNFTManager [static] | FLARManager | ||
TRACKER_ID_FLARTOOLKIT : String = FLARToolkitManager [static] | FLARManager |
activeMarkers | property |
activeMarkers:Vector.<FLARMarker>
[read-only] Vector of all currently-active markers.
public function get activeMarkers():Vector.<FLARMarker>
adaptiveSmoothingCenter | property |
adaptiveSmoothingCenter:Number
Adaptive smoothing reduces jitter in marker transformation matrices for markers with little motion, while maintaining responsiveness for markers with fast motion.
adaptiveSmoothingCenter
is the marker motion distance (between current and last frame)
at which the actual applied smoothing is equal to FLARManager.smoothing
.
When a marker has moved less than adaptiveSmoothingCenter
, smoothing increases;
When a marker has moved more than adaptiveSmoothingCenter
, smoothing decreases.
public function get adaptiveSmoothingCenter():Number
public function set adaptiveSmoothingCenter(value:Number):void
flarCameraSource | property |
flarCameraSource:FLARCameraSource
[read-only] Reference to FLARCameraSource used in this application. If this application does not use a camera, returns null.
public function get flarCameraSource():FLARCameraSource
flarSource | property |
flarSource:IFLARSource
[read-only] IFLARSource instance FLARManager is using as the source image for marker detection.
public function get flarSource():IFLARSource
inverted | property |
inverted:Boolean
Set to true
to detect inverted (white border) markers.
If inverted has not yet been set to true in this session, there will be a slight delay before inverted becomes true, while the inversion shader is loaded.
Thanks to Jim Alliban and Lee Brimelow for the inversion algorithm.
public function get inverted():Boolean
public function set inverted(value:Boolean):void
isActive | property |
isActive:Boolean
true
if this FLARManager instance is active and currently performing marker detection.
public function get isActive():Boolean
public function set isActive(value:Boolean):void
markerExtrapolation | property |
markerExtrapolation:Boolean
If true
, FLARManager will extrapolate the position of a FLARMarker from its velocity when last detected.
Extrapolation continues until markerRemovalDelay frames after trackerManager
reports a marker removed.
Enabling markerExtrapolation
can sometimes improve tracking during fast marker motion.
public function get markerExtrapolation():Boolean
public function set markerExtrapolation(value:Boolean):void
markerRemovalDelay | property |
markerRemovalDelay:int
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
.
public function get markerRemovalDelay():int
public function set markerRemovalDelay(value:int):void
markerUpdateThreshold | property |
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. 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.
public function get markerUpdateThreshold():Number
public function set markerUpdateThreshold(value:Number):void
mirrorDisplay | property |
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.
public function get mirrorDisplay():Boolean
public function set mirrorDisplay(value:Boolean):void
sampleBlurring | property |
sampleBlurring:int
The amount of blur applied to the source image before sending to tracker for image analysis / object detection. Higher values may increase framerate, but may also reduce detection accuracy.
Value must be zero or greater.
The default value is 2
.
public function get sampleBlurring():int
public function set sampleBlurring(value:int):void
smoother | property |
smoother:IFLARMatrixSmoother
IFLARMatrixSmoother to use to apply smoothing to transformation matrices generated by trackerManager
.
public function get smoother():IFLARMatrixSmoother
public function set smoother(value:IFLARMatrixSmoother):void
smoothing | property |
smoothing:int
Apply a smoothing algorithm to transformation matrices generated by trackerManager
.
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.
public function get smoothing():int
public function set smoothing(value:int):void
threshold | property |
threshold:int
Threshold applied to BitmapData before tracker analysis.
Pixels in source image with a brightness <= to this.threshold
are candidates for marker outline detection.
defaults to 80
(values can range from 0
to 255
).
public function get threshold():int
public function set threshold(value:int):void
thresholdAdapter | property |
thresholdAdapter:IThresholdAdapter
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 when using FLARToolkit, 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 DrunkHistogramThresholdAdapter, but developers can implement their own algorithms for adaptive thresholding. To do so, implement the IThresholdAdapter interface.
public function get thresholdAdapter():IThresholdAdapter
public function set thresholdAdapter(value:IThresholdAdapter):void
trackerId | property |
trackerId:String
[read-only] String id of layer of FLARManager that interfaces with the selected tracking library.
public function get trackerId():String
trackerManager | property |
trackerManager:IFLARTrackerManager
[read-only] The layer of FLARManager that interfaces with the selected tracking library. Exposed here to grant developers access to more control over tracker library parameters.
public function get trackerManager():IFLARTrackerManager
verbose | property |
verbose:Boolean
If true
, FLARManager will output configuration changes to the console.
public function get verbose():Boolean
public function set verbose(value:Boolean):void
version | property |
version:String
[read-only] Current version of FLARManager.
public function get version():String
FLARManager | () | Constructor |
public function FLARManager(flarConfig:*, trackerManager:IFLARTrackerManager, stage:Stage)
Constructor.
Dispatches the following events:
Event.COMPLETE
: when the configuration xml is loaded and parsed.
Event.INIT
: when the trackerManager
has initialized and FLARManager begins detecting markers.
ErrorEvent.ERROR
: in the case that configuration loading or parsing fails.
ErrorEvent.ERROR
: in the case that camera initialization fails.
flarConfig:* — Pass the path to the FLARManager configuration xml file as a String to load the file;
or pass an XML instance to configure FLARManager directly.
For more information about the xml configuration file, please see
the online documentation.
| |
trackerManager:IFLARTrackerManager — An IFLARTrackerManager instance that communicates with a tracking library.
The IFLARTrackerManager selected specifies the tracking library that will be used.
| |
stage:Stage — Reference to Stage. Required by some trackers.
|
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.
ENTER_FRAME
loop continues, to update video.
dispose | () | method |
public function dispose():void
Halts all processes and frees this instance for garbage collection.
getProjectionMatrix | () | method |
public function getProjectionMatrix(frameworkId:int, viewportSize:Rectangle):Matrix3D
Get tracker projection matrix. Used to init cameras for 3D frameworks.
Parameters
frameworkId:int — ID of the selected 3D framework, enumerated in FLARManager.
| |
viewportSize:Rectangle — Rectangle that describes bounds of 3D viewport.
|
Matrix3D |
FRAMEWORK_ID_ALTERNATIVA | Constant |
public static const FRAMEWORK_ID_ALTERNATIVA:int = 2
FRAMEWORK_ID_AWAY | Constant |
public static const FRAMEWORK_ID_AWAY:int = 3
FRAMEWORK_ID_AWAY_LITE | Constant |
public static const FRAMEWORK_ID_AWAY_LITE:int = 4
FRAMEWORK_ID_FLASH | Constant |
public static const FRAMEWORK_ID_FLASH:int = 1
FRAMEWORK_ID_PAPERVISION | Constant |
public static const FRAMEWORK_ID_PAPERVISION:int = 5
FRAMEWORK_ID_SANDY | Constant |
public static const FRAMEWORK_ID_SANDY:int = 6
TRACKER_ID_FLARE | Constant |
public static const TRACKER_ID_FLARE:String = FlareManager
TRACKER_ID_FLARE_NFT | Constant |
public static const TRACKER_ID_FLARE_NFT:String = FlareNFTManager
TRACKER_ID_FLARTOOLKIT | Constant |
public static const TRACKER_ID_FLARTOOLKIT:String = FLARToolkitManager