Package | com.transmote.flar.source |
Class | public class FLARCameraSource |
Inheritance | FLARCameraSource flash.display.Sprite |
Implements | IFLARSource |
See also
Property | Defined 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 |
Method | Defined 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 |
activityThreshold | property |
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/
public function get activityThreshold():int
public function set activityThreshold(value:int):void
cameraIndex | property |
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.
public function get cameraIndex():int
public function set cameraIndex(value:int):void
inited | property |
inited:Boolean
[read-only]
Returns true
if initialization is complete.
public function get inited():Boolean
mirrored | property |
mirrored:Boolean
Set to true
to flip the camera image horizontally.
public function get mirrored():Boolean
public function set mirrored(value:Boolean):void
source | property |
source:BitmapData
[read-only]
Retrieve the BitmapData
source used for analysis.
NOTE: returns the actual BitmapData
object, not a clone.
public function get source():BitmapData
sourceDirty | property |
sourceDirty:Boolean
[read-only]
Returns true
if the camera view has changed more than activityThreshold
this frame.
public function get sourceDirty():Boolean
sourceSize | property |
sourceSize:Rectangle
[read-only]
Size of BitmapData
source used for analysis.
public function get sourceSize():Rectangle
trackerToDisplayRatio | property |
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.
public function get trackerToDisplayRatio():Number
useDefaultCamera | property |
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.
public function get useDefaultCamera():Boolean
public function set useDefaultCamera(value:Boolean):void
FLARCameraSource | () | Constructor |
public function FLARCameraSource()
Constructor.
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 )
|
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.
|
Boolean — true If selected Camera is active (activityLevel != -1 ).
|