SurfaceTracker Class

Description

SurfaceTracker实现了对环境表面的跟踪。

SurfaceTracker占用1个camera的buffer。应使用camera的setBufferCapacity设置不少于所有组件占用的camera的buffer数量。参考 概览 _ 。

创建之后,可以调用start/stop来开始和停止运行,start/stop是非常轻量的调用。

当不再需要该组件时,可以调用close对其进行关闭。close之后不应继续使用。

SurfaceTracker通过inputFrameSink输入 InputFrame ,应将 InputFrameSource 连接到inputFrameSink上进行使用。参考 概览 _ 。

isAvailable

只在Android、iOS系统上且加速度计、陀螺仪可用时返回true。

C: bool easyar_SurfaceTracker_isAvailable(void)
C++17: static bool isAvailable()
Traditional 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()

inputFrameSink

InputFrame 输入端口。 InputFrame 要求必须拥有图像、时间戳和camera参数。

C: void easyar_SurfaceTracker_inputFrameSink(easyar_SurfaceTracker * This, easyar_InputFrameSink * * Return)
C++17: std::shared_ptr<InputFrameSink> inputFrameSink()
Traditional C++: void inputFrameSink(InputFrameSink * * Return)
Java: public @Nonnull InputFrameSink inputFrameSink()
Kotlin: fun inputFrameSink(): InputFrameSink
Objective-C: - (easyar_InputFrameSink *)inputFrameSink
Swift: public func inputFrameSink() -> InputFrameSink
C#: public virtual InputFrameSink inputFrameSink()

bufferRequirement

(since 3.1.0)

当前组件占用camera buffer的数量。

C: int easyar_SurfaceTracker_bufferRequirement(easyar_SurfaceTracker * This)
C++17: int bufferRequirement()
Traditional 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 输出端口。

C: void easyar_SurfaceTracker_outputFrameSource(easyar_SurfaceTracker * This, easyar_OutputFrameSource * * Return)
C++17: std::shared_ptr<OutputFrameSource> outputFrameSource()
Traditional C++: void outputFrameSource(OutputFrameSource * * Return)
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

创建。

C: void easyar_SurfaceTracker_create(easyar_SurfaceTracker * * Return)
C++17: static std::shared_ptr<SurfaceTracker> create()
Traditional C++: static void create(SurfaceTracker * * Return)
Java: public static @Nonnull SurfaceTracker create()
Kotlin: companion object fun create(): SurfaceTracker
Objective-C: + (easyar_SurfaceTracker *)create
Swift: public static func create() -> SurfaceTracker
C#: public static SurfaceTracker create()

start

开始跟踪算法。

C: bool easyar_SurfaceTracker_start(easyar_SurfaceTracker * This)
C++17: bool start()
Traditional 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

暂停跟踪算法。调用start来重新启动跟踪。

C: void easyar_SurfaceTracker_stop(easyar_SurfaceTracker * This)
C++17: void stop()
Traditional 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之后不应继续使用。

C: void easyar_SurfaceTracker_close(easyar_SurfaceTracker * This)
C++17: void close()
Traditional 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()

alignTargetToCameraImagePoint

将跟踪目标点对准到相机图像的指定点。图像坐标系([0, 1]^2)的x朝右、y朝下,原点在左上角。可以使用 CameraParameters.imageCoordinatesFromScreenCoordinates 来从屏幕坐标转换为图像坐标。

C: void easyar_SurfaceTracker_alignTargetToCameraImagePoint(easyar_SurfaceTracker * This, easyar_Vec2F cameraImagePoint)
C++17: void alignTargetToCameraImagePoint(Vec2F cameraImagePoint)
Traditional C++: void alignTargetToCameraImagePoint(Vec2F cameraImagePoint)
Java: public void alignTargetToCameraImagePoint(@Nonnull Vec2F cameraImagePoint)
Kotlin: fun alignTargetToCameraImagePoint(cameraImagePoint: Vec2F): Unit
Objective-C: - (void)alignTargetToCameraImagePoint:(easyar_Vec2F *)cameraImagePoint
Swift: public func alignTargetToCameraImagePoint(_ cameraImagePoint: Vec2F) -> Void
C#: public virtual void alignTargetToCameraImagePoint(Vec2F cameraImagePoint)