ImageTracker Class¶
Description¶
ImageTracker implements image target detection and tracking.
ImageTracker 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.
ImageTracker inputs FeedbackFrame from feedbackFrameSink. FeedbackFrameSource shall be connected to feedbackFrameSink for use. Refer to Overview .
Before a Target can be tracked by ImageTracker, you have to load it using loadTarget/unloadTarget. You can get load/unload results from callbacks passed into the interfaces.
isAvailable¶
Returns true.
- C
bool easyar_ImageTracker_isAvailable(void)
- C++
static bool isAvailable()
- Java
public static boolean isAvailable()
- Kotlin
companion object fun isAvailable(): Boolean
- Objective-C
+ (bool)isAvailable
- Swift
public static func isAvailable() -> Bool
- C#
public static bool isAvailable()
feedbackFrameSink¶
FeedbackFrame input port. The InputFrame member of FeedbackFrame must have raw image, timestamp, and camera parameters. Both pinhole and fisheye camera are supported.
- C
void easyar_ImageTracker_feedbackFrameSink(easyar_ImageTracker * This, easyar_FeedbackFrameSink * * Return)
- C++
std::shared_ptr<FeedbackFrameSink> feedbackFrameSink()
- Java
public @Nonnull FeedbackFrameSink feedbackFrameSink()
- Kotlin
fun feedbackFrameSink(): FeedbackFrameSink
- Objective-C
- (easyar_FeedbackFrameSink *)feedbackFrameSink
- Swift
public func feedbackFrameSink() -> FeedbackFrameSink
- C#
public virtual FeedbackFrameSink feedbackFrameSink()
bufferRequirement¶
Camera buffers occupied in this component.
- C
int easyar_ImageTracker_bufferRequirement(easyar_ImageTracker * This)
- C++
int bufferRequirement()
- Java
public int bufferRequirement()
- Kotlin
fun bufferRequirement(): Int
- Objective-C
- (int)bufferRequirement
- Swift
public func bufferRequirement() -> Int32
- C#
public virtual int bufferRequirement()
outputFrameSource¶
OutputFrame output port.
- C
void easyar_ImageTracker_outputFrameSource(easyar_ImageTracker * This, easyar_OutputFrameSource * * Return)
- C++
std::shared_ptr<OutputFrameSource> outputFrameSource()
- Java
public @Nonnull OutputFrameSource outputFrameSource()
- Kotlin
fun outputFrameSource(): OutputFrameSource
- Objective-C
- (easyar_OutputFrameSource *)outputFrameSource
- Swift
public func outputFrameSource() -> OutputFrameSource
- C#
public virtual OutputFrameSource outputFrameSource()
create¶
Creates an instance. The default track mode is ImageTrackerMode.PreferQuality .
- C
void easyar_ImageTracker_create(easyar_ImageTracker * * Return)
- C++
static std::shared_ptr<ImageTracker> create()
- Java
public static @Nonnull ImageTracker create()
- Kotlin
companion object fun create(): ImageTracker
- Objective-C
+ (easyar_ImageTracker *)create
- Swift
public static func create() -> ImageTracker
- C#
public static ImageTracker create()
createWithMode¶
Creates an instance with a specified track mode. On lower-end phones, ImageTrackerMode.PreferPerformance can be used to keep a better performance with a little quality loss.
- C
void easyar_ImageTracker_createWithMode(easyar_ImageTrackerMode trackMode, easyar_ImageTracker * * Return)
- C++
static std::shared_ptr<ImageTracker> createWithMode(ImageTrackerMode trackMode)
- Java
public static @Nonnull ImageTracker createWithMode(int trackMode)
- Kotlin
companion object fun createWithMode(trackMode: Int): ImageTracker
- Objective-C
+ (easyar_ImageTracker *)createWithMode:(easyar_ImageTrackerMode)trackMode
- Swift
public static func createWithMode(_ trackMode: ImageTrackerMode) -> ImageTracker
- C#
public static ImageTracker createWithMode(ImageTrackerMode trackMode)
createWithConfig¶
Creates an instance with a specified config.
- C
void easyar_ImageTracker_createWithConfig(easyar_ImageTrackerConfig * config, easyar_ImageTracker * * Return)
- C++
static std::shared_ptr<ImageTracker> createWithConfig(std::shared_ptr<ImageTrackerConfig> config)
- Java
public static @Nonnull ImageTracker createWithConfig(@Nonnull ImageTrackerConfig config)
- Kotlin
companion object fun createWithConfig(config: ImageTrackerConfig): ImageTracker
- Objective-C
+ (easyar_ImageTracker *)createWithConfig:(easyar_ImageTrackerConfig *)config
- Swift
public static func createWithConfig(_ config: ImageTrackerConfig) -> ImageTracker
- C#
public static ImageTracker createWithConfig(ImageTrackerConfig config)
setResultPostProcessing¶
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 .
- C
void easyar_ImageTracker_setResultPostProcessing(easyar_ImageTracker * This, bool enablePersistentTargetInstance, bool enableMotionFusion)
- C++
void setResultPostProcessing(bool enablePersistentTargetInstance, bool enableMotionFusion)
- Java
public void setResultPostProcessing(boolean enablePersistentTargetInstance, boolean enableMotionFusion)
- Kotlin
fun setResultPostProcessing(enablePersistentTargetInstance: Boolean, enableMotionFusion: Boolean): Unit
- Objective-C
- (void)setResultPostProcessing:(bool)enablePersistentTargetInstance enableMotionFusion:(bool)enableMotionFusion
- Swift
public func setResultPostProcessing(_ enablePersistentTargetInstance: Bool, _ enableMotionFusion: Bool) -> Void
- C#
public virtual void setResultPostProcessing(bool enablePersistentTargetInstance, bool enableMotionFusion)
setResultAsyncMode¶
Sets result async mode. Set true If results are to be outputted via outputFrameSource, false if results are to be fetched via getSyncResult. enableAsync defaults to true. Sync mode is only available with input frames including spatial information and with a XR license.
- C
bool easyar_ImageTracker_setResultAsyncMode(easyar_ImageTracker * This, bool enableAsync)
- C++
bool setResultAsyncMode(bool enableAsync)
- Java
public boolean setResultAsyncMode(boolean enableAsync)
- Kotlin
fun setResultAsyncMode(enableAsync: Boolean): Boolean
- Objective-C
- (bool)setResultAsyncMode:(bool)enableAsync
- Swift
public func setResultAsyncMode(_ enableAsync: Bool) -> Bool
- C#
public virtual bool setResultAsyncMode(bool enableAsync)
start¶
Starts the track algorithm.
- C
bool easyar_ImageTracker_start(easyar_ImageTracker * This)
- C++
bool start()
- Java
public boolean start()
- Kotlin
fun start(): Boolean
- Objective-C
- (bool)start
- Swift
public func start() -> Bool
- C#
public virtual bool start()
stop¶
Stops the track algorithm. Call start to start the track again.
- C
void easyar_ImageTracker_stop(easyar_ImageTracker * This)
- C++
void stop()
- Java
public void stop()
- Kotlin
fun stop(): Unit
- Objective-C
- (void)stop
- Swift
public func stop() -> Void
- C#
public virtual void stop()
close¶
Close. The component shall not be used after calling close.
- C
void easyar_ImageTracker_close(easyar_ImageTracker * This)
- C++
void close()
- Java
public void close()
- Kotlin
fun close(): Unit
- Objective-C
- (void)close
- Swift
public func close() -> Void
- C#
public virtual void close()
loadTarget¶
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.
- C
void easyar_ImageTracker_loadTarget(easyar_ImageTracker * This, easyar_Target * target, easyar_CallbackScheduler * callbackScheduler, easyar_FunctorOfVoidFromTargetAndBool callback)
- C++
void loadTarget(std::shared_ptr<Target> target, std::shared_ptr<CallbackScheduler> callbackScheduler, std::function<void(std::shared_ptr<Target>, bool)> callback)
- Java
public void loadTarget(@Nonnull Target target, @Nonnull CallbackScheduler callbackScheduler, @Nonnull FunctorOfVoidFromTargetAndBool callback)
- Kotlin
fun loadTarget(target: Target, callbackScheduler: CallbackScheduler, callback: FunctorOfVoidFromTargetAndBool): Unit
- Objective-C
- (void)loadTarget:(easyar_Target *)target callbackScheduler:(easyar_CallbackScheduler *)callbackScheduler callback:(void (^)(easyar_Target * target, bool status))callback
- Swift
public func loadTarget(_ target: Target, _ callbackScheduler: CallbackScheduler, _ callback: @escaping (Target, Bool) -> Void) -> Void
- C#
public virtual void loadTarget(Target target, CallbackScheduler callbackScheduler, Action<Target, bool> callback)
unloadTarget¶
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.
- C
void easyar_ImageTracker_unloadTarget(easyar_ImageTracker * This, easyar_Target * target, easyar_CallbackScheduler * callbackScheduler, easyar_FunctorOfVoidFromTargetAndBool callback)
- C++
void unloadTarget(std::shared_ptr<Target> target, std::shared_ptr<CallbackScheduler> callbackScheduler, std::function<void(std::shared_ptr<Target>, bool)> callback)
- Java
public void unloadTarget(@Nonnull Target target, @Nonnull CallbackScheduler callbackScheduler, @Nonnull FunctorOfVoidFromTargetAndBool callback)
- Kotlin
fun unloadTarget(target: Target, callbackScheduler: CallbackScheduler, callback: FunctorOfVoidFromTargetAndBool): Unit
- Objective-C
- (void)unloadTarget:(easyar_Target *)target callbackScheduler:(easyar_CallbackScheduler *)callbackScheduler callback:(void (^)(easyar_Target * target, bool status))callback
- Swift
public func unloadTarget(_ target: Target, _ callbackScheduler: CallbackScheduler, _ callback: @escaping (Target, Bool) -> Void) -> Void
- C#
public virtual void unloadTarget(Target target, CallbackScheduler callbackScheduler, Action<Target, bool> callback)
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.
- C
void easyar_ImageTracker_targets(const easyar_ImageTracker * This, easyar_ListOfTarget * * Return)
- C++
std::vector<std::shared_ptr<Target>> targets()
- Java
public java.util.@Nonnull ArrayList<@Nonnull Target> targets()
- Kotlin
fun targets(): ArrayList<Target>
- Objective-C
- (NSArray<easyar_Target *> *)targets
- Swift
public func targets() -> [Target]
- C#
public virtual List<Target> targets()
setSimultaneousNum¶
Sets the max number of targets which will be the simultaneously tracked by the tracker. The default value is 1.
- C
bool easyar_ImageTracker_setSimultaneousNum(easyar_ImageTracker * This, int num)
- C++
bool setSimultaneousNum(int num)
- Java
public boolean setSimultaneousNum(int num)
- Kotlin
fun setSimultaneousNum(num: Int): Boolean
- Objective-C
- (bool)setSimultaneousNum:(int)num
- Swift
public func setSimultaneousNum(_ num: Int32) -> Bool
- C#
public virtual bool setSimultaneousNum(int num)
simultaneousNum¶
Gets the max number of targets which will be the simultaneously tracked by the tracker. The default value is 1.
- C
int easyar_ImageTracker_simultaneousNum(const easyar_ImageTracker * This)
- C++
int simultaneousNum()
- Java
public int simultaneousNum()
- Kotlin
fun simultaneousNum(): Int
- Objective-C
- (int)simultaneousNum
- Swift
public func simultaneousNum() -> Int32
- C#
public virtual int simultaneousNum()
getSyncResult¶
Get synchronized result. If ImageTracker is paused, or the result async mode is not set to false through setResultAsyncMode, the return value is empty.
- C
void easyar_ImageTracker_getSyncResult(easyar_ImageTracker * This, double timestamp, easyar_Matrix44F cameraTransform, easyar_MotionTrackingStatus trackingStatus, easyar_OptionalOfImageTrackerResult * Return)
- C++
std::optional<std::shared_ptr<ImageTrackerResult>> getSyncResult(double timestamp, Matrix44F cameraTransform, MotionTrackingStatus trackingStatus)
- Java
public @Nullable ImageTrackerResult getSyncResult(double timestamp, @Nonnull Matrix44F cameraTransform, int trackingStatus)
- Kotlin
fun getSyncResult(timestamp: Double, cameraTransform: Matrix44F, trackingStatus: Int): ImageTrackerResult?
- Objective-C
- (easyar_ImageTrackerResult *)getSyncResult:(double)timestamp cameraTransform:(easyar_Matrix44F *)cameraTransform trackingStatus:(easyar_MotionTrackingStatus)trackingStatus
- Swift
public func getSyncResult(_ timestamp: Double, _ cameraTransform: Matrix44F, _ trackingStatus: MotionTrackingStatus) -> ImageTrackerResult?
- C#
public virtual Optional<ImageTrackerResult> getSyncResult(double timestamp, Matrix44F cameraTransform, MotionTrackingStatus trackingStatus)