SparseSpatialMap Class¶
Description¶
提供SparseSpatialMap系统主要的功能,地图生成和存储、地图加载和定位,同时可以获取点云,平面等环境信息并进行hit Test。
SparseSpatialMap占用2个camera的buffer。应使用camera的setBufferCapacity设置不少于所有组件占用的camera的buffer数量。参考 概览 _ 。
isAvailable¶
检查SparseSpatialMap是否可用。总是返回true。
- C
bool easyar_SparseSpatialMap_isAvailable(void)
- C++17
static bool isAvailable()
- C++03
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¶
输入帧输入端口。SparseSpatialMap输入帧必须包含camera参数、时间戳信息和空间信息(cameraTransform和trackingStatus)。参考 InputFrameSink 。
- C
void easyar_SparseSpatialMap_inputFrameSink(easyar_SparseSpatialMap * This, easyar_InputFrameSink * * Return)
- C++17
std::shared_ptr<InputFrameSink> inputFrameSink()
- C++03
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¶
当前组件占用camera buffer的数量。
- C
int easyar_SparseSpatialMap_bufferRequirement(easyar_SparseSpatialMap * This)
- C++17
int bufferRequirement()
- C++03
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¶
输出帧输出端口。参考 OutputFrameSource 。
- C
void easyar_SparseSpatialMap_outputFrameSource(easyar_SparseSpatialMap * This, easyar_OutputFrameSource * * Return)
- C++17
std::shared_ptr<OutputFrameSource> outputFrameSource()
- C++03
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¶
构造SparseSpatialMap。
- C
void easyar_SparseSpatialMap_create(easyar_SparseSpatialMap * * Return)
- C++17
static std::shared_ptr<SparseSpatialMap> create()
- C++03
static void create(SparseSpatialMap * * Return)
- Java
public static @Nonnull SparseSpatialMap create()
- Kotlin
companion object fun create(): SparseSpatialMap
- Objective-C
+ (easyar_SparseSpatialMap *)create
- Swift
public static func create() -> SparseSpatialMap
- C#
public static SparseSpatialMap create()
start¶
开始SparseSpatialMap算法。
- C
bool easyar_SparseSpatialMap_start(easyar_SparseSpatialMap * This)
- C++17
bool start()
- C++03
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¶
停止SparseSpatialMap算法。调用start重新运行。
- C
void easyar_SparseSpatialMap_stop(easyar_SparseSpatialMap * This)
- C++17
void stop()
- C++03
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¶
关闭SparseSpatialMap。close之后不应继续使用。
- C
void easyar_SparseSpatialMap_close(easyar_SparseSpatialMap * This)
- C++17
void close()
- C++03
void close()
- Java
public void close()
- Kotlin
fun close(): Unit
- Objective-C
- (void)close
- Swift
public func close() -> Void
- C#
public virtual void close()
getPointCloudBuffer¶
获取当前点云数据位置信息。其中点云位置为世界坐标系中的位置,buffer每一个点由三个连续的值表示,分别代表X,Y,Z轴上的坐标值,每一个值占用4字节。
- C
void easyar_SparseSpatialMap_getPointCloudBuffer(easyar_SparseSpatialMap * This, easyar_Buffer * * Return)
- C++17
std::shared_ptr<Buffer> getPointCloudBuffer()
- C++03
void getPointCloudBuffer(Buffer * * Return)
- Java
public @Nonnull Buffer getPointCloudBuffer()
- Kotlin
fun getPointCloudBuffer(): Buffer
- Objective-C
- (easyar_Buffer *)getPointCloudBuffer
- Swift
public func getPointCloudBuffer() -> Buffer
- C#
public virtual Buffer getPointCloudBuffer()
getMapPlanes¶
获取检测到的平面,类型为 PlaneType 。
- C
void easyar_SparseSpatialMap_getMapPlanes(easyar_SparseSpatialMap * This, easyar_ListOfPlaneData * * Return)
- C++17
std::vector<std::shared_ptr<PlaneData>> getMapPlanes()
- C++03
void getMapPlanes(ListOfPlaneData * * Return)
- Java
public java.util.@Nonnull ArrayList<@Nonnull PlaneData> getMapPlanes()
- Kotlin
fun getMapPlanes(): ArrayList<PlaneData>
- Objective-C
- (NSArray<easyar_PlaneData *> *)getMapPlanes
- Swift
public func getMapPlanes() -> [PlaneData]
- C#
public virtual List<PlaneData> getMapPlanes()
hitTestAgainstPointCloud¶
在当前点云中进行Hit Test,得到距离相机从近到远一条射线上的n(n>=0)个位置坐标。
- C
void easyar_SparseSpatialMap_hitTestAgainstPointCloud(easyar_SparseSpatialMap * This, easyar_Vec2F cameraImagePoint, easyar_ListOfVec3F * * Return)
- C++17
std::vector<Vec3F> hitTestAgainstPointCloud(Vec2F cameraImagePoint)
- C++03
void hitTestAgainstPointCloud(Vec2F cameraImagePoint, ListOfVec3F * * Return)
- Java
public java.util.@Nonnull ArrayList<@Nonnull Vec3F> hitTestAgainstPointCloud(@Nonnull Vec2F cameraImagePoint)
- Kotlin
fun hitTestAgainstPointCloud(cameraImagePoint: Vec2F): ArrayList<Vec3F>
- Objective-C
- (NSArray<easyar_Vec3F *> *)hitTestAgainstPointCloud:(easyar_Vec2F *)cameraImagePoint
- Swift
public func hitTestAgainstPointCloud(_ cameraImagePoint: Vec2F) -> [Vec3F]
- C#
public virtual List<Vec3F> hitTestAgainstPointCloud(Vec2F cameraImagePoint)
hitTestAgainstPlanes¶
在当前检测到的平面上进行Hit Test,得到距离相机从近到远一条射线上的n(n>=0)个位置坐标。
输入图像坐标系([0, 1]^2)的x朝右、y朝下,原点在左上角。可以使用 CameraParameters.imageCoordinatesFromScreenCoordinates 来从屏幕坐标转换为图像坐标。
输出为点云在世界坐标系中的坐标。
- C
void easyar_SparseSpatialMap_hitTestAgainstPlanes(easyar_SparseSpatialMap * This, easyar_Vec2F cameraImagePoint, easyar_ListOfVec3F * * Return)
- C++17
std::vector<Vec3F> hitTestAgainstPlanes(Vec2F cameraImagePoint)
- C++03
void hitTestAgainstPlanes(Vec2F cameraImagePoint, ListOfVec3F * * Return)
- Java
public java.util.@Nonnull ArrayList<@Nonnull Vec3F> hitTestAgainstPlanes(@Nonnull Vec2F cameraImagePoint)
- Kotlin
fun hitTestAgainstPlanes(cameraImagePoint: Vec2F): ArrayList<Vec3F>
- Objective-C
- (NSArray<easyar_Vec3F *> *)hitTestAgainstPlanes:(easyar_Vec2F *)cameraImagePoint
- Swift
public func hitTestAgainstPlanes(_ cameraImagePoint: Vec2F) -> [Vec3F]
- C#
public virtual List<Vec3F> hitTestAgainstPlanes(Vec2F cameraImagePoint)
getMapVersion¶
获取当前SparseSpatialMap的地图版本。
- C
void easyar_SparseSpatialMap_getMapVersion(easyar_String * * Return)
- C++17
static std::string getMapVersion()
- C++03
static void getMapVersion(String * * Return)
- Java
public static java.lang.@Nonnull String getMapVersion()
- Kotlin
companion object fun getMapVersion(): String
- Objective-C
+ (NSString *)getMapVersion
- Swift
public static func getMapVersion() -> String
- C#
public static string getMapVersion()
unloadMap¶
通过回调,卸载指定的SparseSpatialMap地图数据。可以通过回调的返回值判断卸载是否成功,成功返回true,否则返回false。
- C
void easyar_SparseSpatialMap_unloadMap(easyar_SparseSpatialMap * This, easyar_String * mapID, easyar_CallbackScheduler * callbackScheduler, easyar_OptionalOfFunctorOfVoidFromBool resultCallBack)
- C++17
void unloadMap(std::string mapID, std::shared_ptr<CallbackScheduler> callbackScheduler, std::optional<std::function<void(bool)>> resultCallBack)
- C++03
void unloadMap(String * mapID, CallbackScheduler * callbackScheduler, OptionalOfFunctorOfVoidFromBool resultCallBack)
- Java
public void unloadMap(java.lang.@Nonnull String mapID, @Nonnull CallbackScheduler callbackScheduler, @Nullable FunctorOfVoidFromBool resultCallBack)
- Kotlin
fun unloadMap(mapID: String, callbackScheduler: CallbackScheduler, resultCallBack: FunctorOfVoidFromBool?): Unit
- Objective-C
- (void)unloadMap:(NSString *)mapID callbackScheduler:(easyar_CallbackScheduler *)callbackScheduler resultCallBack:(void (^)(bool))resultCallBack
- Swift
public func unloadMap(_ mapID: String, _ callbackScheduler: CallbackScheduler, _ resultCallBack: ((Bool) -> Void)?) -> Void
- C#
public virtual void unloadMap(string mapID, CallbackScheduler callbackScheduler, Optional<Action<bool>> resultCallBack)
setConfig¶
设置SparseSpatialMap相关的配置。参考 SparseSpatialMapConfig 。
- C
void easyar_SparseSpatialMap_setConfig(easyar_SparseSpatialMap * This, easyar_SparseSpatialMapConfig * config)
- C++17
void setConfig(std::shared_ptr<SparseSpatialMapConfig> config)
- C++03
void setConfig(SparseSpatialMapConfig * config)
- Java
public void setConfig(@Nonnull SparseSpatialMapConfig config)
- Kotlin
fun setConfig(config: SparseSpatialMapConfig): Unit
- Objective-C
- (void)setConfig:(easyar_SparseSpatialMapConfig *)config
- Swift
public func setConfig(_ config: SparseSpatialMapConfig) -> Void
- C#
public virtual void setConfig(SparseSpatialMapConfig config)
getConfig¶
获取SparseSpatialMap相关的配置。参考 SparseSpatialMapConfig 。
- C
void easyar_SparseSpatialMap_getConfig(easyar_SparseSpatialMap * This, easyar_SparseSpatialMapConfig * * Return)
- C++17
std::shared_ptr<SparseSpatialMapConfig> getConfig()
- C++03
void getConfig(SparseSpatialMapConfig * * Return)
- Java
public @Nonnull SparseSpatialMapConfig getConfig()
- Kotlin
fun getConfig(): SparseSpatialMapConfig
- Objective-C
- (easyar_SparseSpatialMapConfig *)getConfig
- Swift
public func getConfig() -> SparseSpatialMapConfig
- C#
public virtual SparseSpatialMapConfig getConfig()
startLocalization¶
开始在已加载地图中尝试定位。在此之前,需要设定所需的配置参数。参考 LocalizationMode 。
- C
bool easyar_SparseSpatialMap_startLocalization(easyar_SparseSpatialMap * This)
- C++17
bool startLocalization()
- C++03
bool startLocalization()
- Java
public boolean startLocalization()
- Kotlin
fun startLocalization(): Boolean
- Objective-C
- (bool)startLocalization
- Swift
public func startLocalization() -> Bool
- C#
public virtual bool startLocalization()
stopLocalization¶
停当前定位过程。
- C
void easyar_SparseSpatialMap_stopLocalization(easyar_SparseSpatialMap * This)
- C++17
void stopLocalization()
- C++03
void stopLocalization()
- Java
public void stopLocalization()
- Kotlin
fun stopLocalization(): Unit
- Objective-C
- (void)stopLocalization
- Swift
public func stopLocalization() -> Void
- C#
public virtual void stopLocalization()