ObjectTracker Class¶
This type is an EasyAR Sense API in C#: ObjectTracker . Some descriptions may not apply to Unity environment on this page.
This type is partially wrapped into Unity components: ObjectTrackerFrameFilter . Members and instances of this type are not required to be used directly in most situations. Use this type by ObjectTrackerFrameFilter.Tracker instead of creating new instances when a few unwrapped API is desired for use.
Description¶
ObjectTracker implements 3D object target detection and tracking.
ObjectTracker occupies (1 + SimultaneousNum) buffers of camera. Use setBufferCapacity of camera to set an amount of buffers that is not less than the sum of amount of buffers occupied by all components. Refer to Overview .
After creation, you can call start/stop to enable/disable the track process. start and stop are very lightweight calls.
When the component is not needed anymore, call close function to close it. It shall not be used after calling close.
ObjectTracker inputs FeedbackFrame from feedbackFrameSink. FeedbackFrameSource shall be connected to feedbackFrameSink for use. Refer to Overview .
Before a Target can be tracked by ObjectTracker, you have to load it using loadTarget/unloadTarget. You can get load/unload results from callbacks passed into the interfaces.
Methods¶
isAvailable¶
- C#
public static bool isAvailable()
Returns true.
feedbackFrameSink¶
- C#
public virtual FeedbackFrameSink feedbackFrameSink()
FeedbackFrame input port. The InputFrame member of FeedbackFrame must have raw image, timestamp, and camera parameters.
bufferRequirement¶
- C#
public virtual int bufferRequirement()
Camera buffers occupied in this component.
outputFrameSource¶
- C#
public virtual OutputFrameSource outputFrameSource()
OutputFrame output port.
create¶
- C#
public static ObjectTracker create()
Creates an instance.
setResultPostProcessing¶
- C#
public virtual void setResultPostProcessing(bool enablePersistentTargetInstance, bool enableMotionFusion)
Sets result post-processing.
enablePersistentTargetInstance defaults to false. When it is enabled and InputFrame contains spatial information, targetInstances in ImageTrackerResult will contain all recognized instances (with not tracking target instances).
enableMotionFusion defaults to false. When it is enabled and InputFrame contains temporal information and spatial information, pose of targetInstances in ImageTrackerResult will utilize RealTimeCoordinateTransform .
start¶
- C#
public virtual bool start()
Starts the track algorithm.
stop¶
- C#
public virtual void stop()
Stops the track algorithm. Call start to start the track again.
close¶
- C#
public virtual void close()
Close. The component shall not be used after calling close.
loadTarget¶
- C#
public virtual void loadTarget( Target target, CallbackScheduler callbackScheduler, Action< Target , bool> callback)
Load a Target into the tracker. A Target can only be tracked by tracker after a successful load.
This method is an asynchronous 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. If you want to know the load result, you have to handle the callback data. The callback will be called from the thread specified by CallbackScheduler . It will not block the track thread or any other operations except other load/unload.
unloadTarget¶
- C#
public virtual void unloadTarget( Target target, CallbackScheduler callbackScheduler, Action< Target , bool> callback)
Unload a Target from the tracker.
This method is an asynchronous method. An unload operation may take some time to finish and detection of a new/lost target may take more time during the unload. If you want to know the unload result, you have to handle the callback data. The callback will be called from the thread specified by CallbackScheduler . It will not block the track thread or any other operations except other load/unload.
targets¶
- C#
public virtual List< Target > targets()
Returns current loaded targets in the tracker. If an asynchronous load/unload is in progress, the returned value will not reflect the result until all load/unload finish.
setSimultaneousNum¶
- C#
public virtual bool setSimultaneousNum(int num)
Sets the max number of targets which will be the simultaneously tracked by the tracker. The default value is 1.
simultaneousNum¶
- C#
public virtual int simultaneousNum()
Gets the max number of targets which will be the simultaneously tracked by the tracker. The default value is 1.