ImageTracker Class¶
Inherits: Base
Description¶
An ImageTracker is a class for target detection and tracking.
ImageTracker detects and tracks ImageTarget. You need to call AttachCamera to attach a CameraDevice to ImageTracker first, then the images from the CameraDevice are used for by the tracker. You can call Start/Stop to enable/disable the track process. Start and Stop are very lightweight calls.
Before a Target can be tracked by ImageTracker, you have to load it using async method LoadTarget/UnloadTarget or synchronized LoadTargetBlocked/UnloadTargetBlocked. The async interfaces are recommended if you desire an unblocked process. You can get load/unload results from TargetLoad/TargetUnload events.
You can get a Frame by Augmenter.newFrame which contains current camera image and tracked AugmentedTarget.
Public Properties¶
Public Functions¶
Public Events¶
ImageTracker()¶
Creates a ImageTracker object.
List<Target> Targets¶
Returns current loaded targets in the tracker. If an async load/unload is in progress, the returned value will not reflect the result until all load/unload finish.
int SimultaneousNum (since 1.3.0)¶
The max number of targets which will be the simulatneously tracked by the tracker. The default value is 1.
bool AttachCamera(CameraDevice cam)¶
Attach CameraDevice to the ImageTracker. ImageTracker will not start to track until a CameraDevice is attached.
bool DetachCamera(CameraDevice cam)¶
Detach CameraDevice from the ImageTracker. After detach, the ImageTracker will not accept images from the CameraDevice anymore and the track will stop if no CameraDevice is attached.
bool Start()¶
Starts the track algorithm. The track will not actually start until a CameraDevice is attached.
bool Stop()¶
Stops the track algorithm. Call Start to start the track again.
void LoadTarget(Target target)¶
Load a Target into the tracker. A Target can only be tracked by ImageTracker after a successful load.
This method is an async method. A load operation may take some time to finish and detection of a new/lost target may take more time during the load. The track time after detection will not be affected. The load result will be returned in TargetLoad event.
bool LoadTargetBlocked(Target target)¶
Load a Target into the tracker. A Target can only be tracked by ImageTracker after a successful load.
This is a synchronized method. A load operation may take some time to finish and detection of a new/lost target may take more time during the load. It will block the calling thread. However, the track thread or camera thread will not be blocked.
void UnloadTarget(Target target)¶
Unload a Target from the tracker.
This method is an async method. An unload operation may take some time to finish and detection of a new/lost target may take more time during the unload. The unload result will be returned from in TargetUnload event.
bool UnloadTargetBlocked(Target target)¶
Unload a Target from the tracker.
This is a synchronized method. An unload operation may take some time to finish and detection of a new/lost target may take more time during the unload. It will block the calling thread. However, the track thread or camera thread will not be blocked.
event Action<ImageTracker, Target, bool> TargetLoad¶
Event when target load finish. status is true if the load success, otherwise is false.
event Action<ImageTracker, Target, bool> TargetUnload¶
Event when target unload finish. status is true if the unload success, otherwise is false.