Class SparseSpatialMap
- Namespace
- easyar
Provide the main functions of the SparseSpatialMap system, map generation and storage, map loading and localization, and can obtain environmental information such as point clouds and planes and perform hit Test. SparseSpatialMap occupies 2 camera buffers. The setBufferCapacity of the camera should be used to set the number of camera buffers occupied by all components to not less than the number.
Methods
isAvailable
Check if SparseSpatialMap is available. Always return true.
bool easyar_SparseSpatialMap_isAvailable(void)
static bool isAvailable()
public static boolean isAvailable()
companion object fun isAvailable(): Boolean
+ (bool)isAvailable
public static func isAvailable() -> Bool
public static bool isAvailable()
Returns
- Boolean
inputFrameSink
Input frame input port. The SparseSpatialMap input frame must contain camera parameters, timestamp information and spatial information (cameraTransform and trackingStatus). Reference InputFrameSink. Note: The camera supports pinhole and fisheye camera models, and the performance will be affected when using a fisheye camera.
void easyar_SparseSpatialMap_inputFrameSink(easyar_SparseSpatialMap * This, easyar_InputFrameSink * * Return)
std::shared_ptr<InputFrameSink> inputFrameSink()
public @Nonnull InputFrameSink inputFrameSink()
fun inputFrameSink(): InputFrameSink
- (easyar_InputFrameSink *)inputFrameSink
public func inputFrameSink() -> InputFrameSink
public virtual InputFrameSink inputFrameSink()
Returns
bufferRequirement
The number of camera buffers occupied by the current component.
int easyar_SparseSpatialMap_bufferRequirement(easyar_SparseSpatialMap * This)
int bufferRequirement()
public int bufferRequirement()
fun bufferRequirement(): Int
- (int)bufferRequirement
public func bufferRequirement() -> Int32
public virtual int bufferRequirement()
Returns
- Int32
outputFrameSource
Output frame output port. Reference OutputFrameSource.
void easyar_SparseSpatialMap_outputFrameSource(easyar_SparseSpatialMap * This, easyar_OutputFrameSource * * Return)
std::shared_ptr<OutputFrameSource> outputFrameSource()
public @Nonnull OutputFrameSource outputFrameSource()
fun outputFrameSource(): OutputFrameSource
- (easyar_OutputFrameSource *)outputFrameSource
public func outputFrameSource() -> OutputFrameSource
public virtual OutputFrameSource outputFrameSource()
Returns
create
Construct SparseSpatialMap.
void easyar_SparseSpatialMap_create(easyar_SparseSpatialMap * * Return)
static std::shared_ptr<SparseSpatialMap> create()
public static @Nonnull SparseSpatialMap create()
companion object fun create(): SparseSpatialMap
+ (easyar_SparseSpatialMap *)create
public static func create() -> SparseSpatialMap
public static SparseSpatialMap create()
Returns
setResultPoseType
Set the result pose type. The default enableStabilization is false. Only valid when InputFrame contains spatial information.
void easyar_SparseSpatialMap_setResultPoseType(easyar_SparseSpatialMap * This, bool enableStabilization)
void setResultPoseType(bool enableStabilization)
public void setResultPoseType(boolean enableStabilization)
fun setResultPoseType(enableStabilization: Boolean): Unit
- (void)setResultPoseType:(bool)enableStabilization
public func setResultPoseType(_ enableStabilization: Bool) -> Void
public virtual void setResultPoseType(bool enableStabilization)
Parameters
enableStabilizationBoolean
Returns
- Void
setResultAsyncMode
Set the result asynchronous mode. If the result is output through outputFrameSource, it should be set to true. If the result is obtained through getSyncResult, it should be set to false. The default enableAsync is true. The synchronous mode is only valid when the input frame contains spatial information and XR License is used.
bool easyar_SparseSpatialMap_setResultAsyncMode(easyar_SparseSpatialMap * This, bool enableAsync)
bool setResultAsyncMode(bool enableAsync)
public boolean setResultAsyncMode(boolean enableAsync)
fun setResultAsyncMode(enableAsync: Boolean): Boolean
- (bool)setResultAsyncMode:(bool)enableAsync
public func setResultAsyncMode(_ enableAsync: Bool) -> Bool
public virtual bool setResultAsyncMode(bool enableAsync)
Parameters
enableAsyncBoolean
Returns
- Boolean
start
Start the SparseSpatialMap algorithm
bool easyar_SparseSpatialMap_start(easyar_SparseSpatialMap * This)
bool start()
public boolean start()
fun start(): Boolean
- (bool)start
public func start() -> Bool
public virtual bool start()
Returns
- Boolean
stop
Stop the SparseSpatialMap algorithm. Call start to run again.
void easyar_SparseSpatialMap_stop(easyar_SparseSpatialMap * This)
void stop()
public void stop()
fun stop(): Unit
- (void)stop
public func stop() -> Void
public virtual void stop()
Returns
- Void
close
Close the SparseSpatialMap. Do not continue to use after close.
void easyar_SparseSpatialMap_close(easyar_SparseSpatialMap * This)
void close()
public void close()
fun close(): Unit
- (void)close
public func close() -> Void
public virtual void close()
Returns
- Void
getPointCloudBuffer
Get the current point cloud data position information. The point cloud position is the position in the world coordinate system, and each point in the buffer is represented by three consecutive values, representing the coordinates on the X, Y, and Z axes respectively, and each value occupies 4 bytes.
void easyar_SparseSpatialMap_getPointCloudBuffer(easyar_SparseSpatialMap * This, easyar_Buffer * * Return)
std::shared_ptr<Buffer> getPointCloudBuffer()
public @Nonnull Buffer getPointCloudBuffer()
fun getPointCloudBuffer(): Buffer
- (easyar_Buffer *)getPointCloudBuffer
public func getPointCloudBuffer() -> Buffer
public virtual Buffer getPointCloudBuffer()
Returns
getMapPlanes
Get the detected plane, the type is PlaneType.
void easyar_SparseSpatialMap_getMapPlanes(easyar_SparseSpatialMap * This, easyar_ListOfPlaneData * * Return)
std::vector<std::shared_ptr<PlaneData>> getMapPlanes()
public java.util.@Nonnull ArrayList<@Nonnull PlaneData> getMapPlanes()
fun getMapPlanes(): ArrayList<PlaneData>
- (NSArray<easyar_PlaneData *> *)getMapPlanes
public func getMapPlanes() -> [PlaneData]
public virtual List<PlaneData> getMapPlanes()
Returns
- List<PlaneData>
hitTestAgainstPointCloud
Perform Hit Test in the current point cloud to get n (n>=0) position coordinates on a ray from near to far from the camera.
void easyar_SparseSpatialMap_hitTestAgainstPointCloud(easyar_SparseSpatialMap * This, easyar_Vec2F cameraImagePoint, easyar_ListOfVec3F * * Return)
std::vector<Vec3F> hitTestAgainstPointCloud(Vec2F cameraImagePoint)
public java.util.@Nonnull ArrayList<@Nonnull Vec3F> hitTestAgainstPointCloud(@Nonnull Vec2F cameraImagePoint)
fun hitTestAgainstPointCloud(cameraImagePoint: Vec2F): ArrayList<Vec3F>
- (NSArray<easyar_Vec3F *> *)hitTestAgainstPointCloud:(easyar_Vec2F *)cameraImagePoint
public func hitTestAgainstPointCloud(_ cameraImagePoint: Vec2F) -> [Vec3F]
public virtual List<Vec3F> hitTestAgainstPointCloud(Vec2F cameraImagePoint)
Parameters
cameraImagePointVec2F
Returns
- List<Vec3F>
hitTestAgainstPlanes
Perform Hit Test on the current detected plane to get n (n>0) position coordinates on a ray from near to far from the camera. The input image coordinate system ([0, 1]^2) has x to the right, y downward, and the origin at the upper left corner. You can use imageCoordinatesFromScreenCoordinates to convert from screen coordinates to image coordinates. The output is the coordinates of the point cloud in the world coordinate system.
void easyar_SparseSpatialMap_hitTestAgainstPlanes(easyar_SparseSpatialMap * This, easyar_Vec2F cameraImagePoint, easyar_ListOfVec3F * * Return)
std::vector<Vec3F> hitTestAgainstPlanes(Vec2F cameraImagePoint)
public java.util.@Nonnull ArrayList<@Nonnull Vec3F> hitTestAgainstPlanes(@Nonnull Vec2F cameraImagePoint)
fun hitTestAgainstPlanes(cameraImagePoint: Vec2F): ArrayList<Vec3F>
- (NSArray<easyar_Vec3F *> *)hitTestAgainstPlanes:(easyar_Vec2F *)cameraImagePoint
public func hitTestAgainstPlanes(_ cameraImagePoint: Vec2F) -> [Vec3F]
public virtual List<Vec3F> hitTestAgainstPlanes(Vec2F cameraImagePoint)
Parameters
cameraImagePointVec2F
Returns
- List<Vec3F>
getMapVersion
Get the current map version of SparseSpatialMap.
void easyar_SparseSpatialMap_getMapVersion(easyar_String * * Return)
static std::string getMapVersion()
public static java.lang.@Nonnull String getMapVersion()
companion object fun getMapVersion(): String
+ (NSString *)getMapVersion
public static func getMapVersion() -> String
public static string getMapVersion()
Returns
- String
unloadMap
Unload the specified SparseSpatialMap map data through the callback. You can judge whether the unloading is successful through the return value of the callback. Return true if successful, otherwise return false.
void easyar_SparseSpatialMap_unloadMap(easyar_SparseSpatialMap * This, easyar_String * mapID, easyar_CallbackScheduler * callbackScheduler, easyar_OptionalOfFunctorOfVoidFromBool resultCallBack)
void unloadMap(std::string mapID, std::shared_ptr<CallbackScheduler> callbackScheduler, std::optional<std::function<void(bool)>> resultCallBack)
public void unloadMap(java.lang.@Nonnull String mapID, @Nonnull CallbackScheduler callbackScheduler, @Nullable FunctorOfVoidFromBool resultCallBack)
fun unloadMap(mapID: String, callbackScheduler: CallbackScheduler, resultCallBack: FunctorOfVoidFromBool?): Unit
- (void)unloadMap:(NSString *)mapID callbackScheduler:(easyar_CallbackScheduler *)callbackScheduler resultCallBack:(void (^)(bool))resultCallBack
public func unloadMap(_ mapID: String, _ callbackScheduler: CallbackScheduler, _ resultCallBack: ((Bool) -> Void)?) -> Void
public virtual void unloadMap(string mapID, CallbackScheduler callbackScheduler, Optional<Action<bool>> resultCallBack)
Parameters
mapIDStringcallbackSchedulerCallbackSchedulerresultCallBackOptional<Action<>>
Returns
- Void
setConfig
Set the configuration related to SparseSpatialMap. Reference SparseSpatialMapConfig.
void easyar_SparseSpatialMap_setConfig(easyar_SparseSpatialMap * This, easyar_SparseSpatialMapConfig * config)
void setConfig(std::shared_ptr<SparseSpatialMapConfig> config)
public void setConfig(@Nonnull SparseSpatialMapConfig config)
fun setConfig(config: SparseSpatialMapConfig): Unit
- (void)setConfig:(easyar_SparseSpatialMapConfig *)config
public func setConfig(_ config: SparseSpatialMapConfig) -> Void
public virtual void setConfig(SparseSpatialMapConfig config)
Parameters
configSparseSpatialMapConfig
Returns
- Void
getConfig
Get the configuration related to SparseSpatialMap. Reference SparseSpatialMapConfig.
void easyar_SparseSpatialMap_getConfig(easyar_SparseSpatialMap * This, easyar_SparseSpatialMapConfig * * Return)
std::shared_ptr<SparseSpatialMapConfig> getConfig()
public @Nonnull SparseSpatialMapConfig getConfig()
fun getConfig(): SparseSpatialMapConfig
- (easyar_SparseSpatialMapConfig *)getConfig
public func getConfig() -> SparseSpatialMapConfig
public virtual SparseSpatialMapConfig getConfig()
Returns
startLocalization
Start trying to localize in the loaded map. Before this, the required configuration parameters need to be set. Reference LocalizationMode.
bool easyar_SparseSpatialMap_startLocalization(easyar_SparseSpatialMap * This)
bool startLocalization()
public boolean startLocalization()
fun startLocalization(): Boolean
- (bool)startLocalization
public func startLocalization() -> Bool
public virtual bool startLocalization()
Returns
- Boolean
stopLocalization
Stop the current localization process.
void easyar_SparseSpatialMap_stopLocalization(easyar_SparseSpatialMap * This)
void stopLocalization()
public void stopLocalization()
fun stopLocalization(): Unit
- (void)stopLocalization
public func stopLocalization() -> Void
public virtual void stopLocalization()
Returns
- Void
getSyncResult
Get the synchronous output result. If SparseSpatialMap is paused, or the result asynchronous mode is not set to false through setResultAsyncMode, the return value is empty.
void easyar_SparseSpatialMap_getSyncResult(easyar_SparseSpatialMap * This, easyar_MotionInputData * motionInputData, easyar_OptionalOfSparseSpatialMapResult * Return)
std::optional<std::shared_ptr<SparseSpatialMapResult>> getSyncResult(std::shared_ptr<MotionInputData> motionInputData)
public @Nullable SparseSpatialMapResult getSyncResult(@Nonnull MotionInputData motionInputData)
fun getSyncResult(motionInputData: MotionInputData): SparseSpatialMapResult?
- (easyar_SparseSpatialMapResult *)getSyncResult:(easyar_MotionInputData *)motionInputData
public func getSyncResult(_ motionInputData: MotionInputData) -> SparseSpatialMapResult?
public virtual Optional<SparseSpatialMapResult> getSyncResult(MotionInputData motionInputData)
Parameters
motionInputDataMotionInputData
Returns
- Optional<SparseSpatialMapResult>