SpatialMappingParameters Class Reference

Class containing a set of parameters for the spatial mapping module. More...

Functions

SpatialMappingParameters __cinit__ (self, resolution=MAPPING_RESOLUTION.MEDIUM, mapping_range=MAPPING_RANGE.AUTO, max_memory_usage=2048, save_texture=False, use_chunk_only=False, reverse_vertex_order=False, map_type=SPATIAL_MAP_TYPE.MESH)
 Default constructor. More...
 
None set_resolution (self, resolution=MAPPING_RESOLUTION.HIGH)
 Sets the resolution to a sl.MAPPING_RESOLUTION preset. More...
 
None set_range (self, mapping_range=MAPPING_RANGE.AUTO)
 Sets the range to a sl.MAPPING_RANGE preset. More...
 
float get_range_preset (self, mapping_range=MAPPING_RANGE.AUTO)
 Returns the value corresponding to a sl.MAPPING_RANGE preset in meters. More...
 
float get_resolution_preset (self, resolution=MAPPING_RESOLUTION.HIGH)
 Returns the value corresponding to a sl.MAPPING_RESOLUTION preset in meters. More...
 
float get_recommended_range (self, resolution, Camera py_cam)
 Returns the recommended maximum depth value corresponding to a resolution. More...
 
SPATIAL_MAP_TYPE map_type (self)
 The type of spatial map to be created. More...
 
int max_memory_usage (self)
 The maximum CPU memory (in MB) allocated for the meshing process. More...
 
bool save_texture (self)
 Whether to save the texture. More...
 
bool use_chunk_only (self)
 Whether to only use chunks. More...
 
bool reverse_vertex_order (self)
 Whether to inverse the order of the vertices of the triangles. More...
 
np.array[float] allowed_range (self)
 The maximum depth allowed by spatial mapping: More...
 
float range_meter (self)
 Depth range in meters. More...
 
np.array[float] allowed_resolution (self)
 The resolution allowed by the spatial mapping: More...
 
float resolution_meter (self)
 Spatial mapping resolution in meters. More...
 
int stability_counter (self)
 Control the integration rate of the current depth into the mapping process. More...
 
bool save (self, str filename)
 Saves the current set of parameters into a file to be reloaded with the load() method. More...
 
bool load (self, str filename)
 Loads a set of parameters from the values contained in a previously saved file. More...
 

Detailed Description

Class containing a set of parameters for the spatial mapping module.

The default constructor sets all parameters to their default settings.

Note
Parameters can be adjusted by the user.

Functions

◆ __cinit__()

SpatialMappingParameters __cinit__ (   self,
  resolution = MAPPING_RESOLUTION.MEDIUM,
  mapping_range = MAPPING_RANGE.AUTO,
  max_memory_usage = 2048,
  save_texture = False,
  use_chunk_only = False,
  reverse_vertex_order = False,
  map_type = SPATIAL_MAP_TYPE.MESH 
)

Default constructor.

Sets all parameters to their default and optimized values.

Parameters
resolution: Chosen MAPPING_RESOLUTION
mapping_range: Chosen MAPPING_RANGE
max_memory_usage: Chosen max_memory_usage
save_texture: Activates save_texture
use_chunk_only: Activates use_chunk_only
reverse_vertex_order: Activates reverse_vertex_order
map_type: Chosen map_type
params = sl.SpatialMappingParameters(resolution=sl.MAPPING_RESOLUTION.HIGH)

◆ set_resolution()

None set_resolution (   self,
  resolution = MAPPING_RESOLUTION.HIGH 
)

Sets the resolution to a sl.MAPPING_RESOLUTION preset.

Parameters
resolutionThe desired sl.MAPPING_RESOLUTION. Default: sl.MAPPING_RESOLUTION.HIGH

◆ set_range()

None set_range (   self,
  mapping_range = MAPPING_RANGE.AUTO 
)

Sets the range to a sl.MAPPING_RANGE preset.

Parameters
mapping_rangeThe desired sl.MAPPING_RANGE. Default: sl.MAPPING_RANGE::AUTO

◆ get_range_preset()

float get_range_preset (   self,
  mapping_range = MAPPING_RANGE.AUTO 
)

Returns the value corresponding to a sl.MAPPING_RANGE preset in meters.

Parameters
mapping_rangeThe desired sl.MAPPING_RANGE. Default: sl.MAPPING_RANGE::AUTO
Returns
The value of mapping_range in meters.

◆ get_resolution_preset()

float get_resolution_preset (   self,
  resolution = MAPPING_RESOLUTION.HIGH 
)

Returns the value corresponding to a sl.MAPPING_RESOLUTION preset in meters.

Parameters
resolutionThe desired sl.MAPPING_RESOLUTION. Default: sl.MAPPING_RESOLUTION.HIGH
Returns
The value of resolution in meters.

◆ get_recommended_range()

float get_recommended_range (   self,
  resolution,
Camera  py_cam 
)

Returns the recommended maximum depth value corresponding to a resolution.

Parameters
resolution: The desired resolution, either defined by a sl.MAPPING_RESOLUTION preset or a resolution value in meters.
py_cam: The sl.Camera object which will run the spatial mapping.
Returns
The maximum value of depth in meters.

◆ map_type()

SPATIAL_MAP_TYPE map_type (   self)

The type of spatial map to be created.

This dictates the format that will be used for the mapping (e.g. mesh, point cloud).
See sl.SPATIAL_MAP_TYPE.

◆ max_memory_usage()

int max_memory_usage (   self)

The maximum CPU memory (in MB) allocated for the meshing process.

Default: 2048

◆ save_texture()

bool save_texture (   self)

Whether to save the texture.

If set to true, you will be able to apply the texture to your mesh after it is created.
Default: False

Note
This option will consume more memory.
This option is only available for sl.SPATIAL_MAP_TYPE.MESH.

◆ use_chunk_only()

bool use_chunk_only (   self)

Whether to only use chunks.

If set to False, you will ensure consistency between the mesh and its inner chunk data.
Default: False

Note
Updating the mesh is time-consuming.
Setting this to True results in better performance.

◆ reverse_vertex_order()

bool reverse_vertex_order (   self)

Whether to inverse the order of the vertices of the triangles.

If your display process does not handle front and back face culling, you can use this to correct it.
Default: False

Note
This option is only available for sl.SPATIAL_MAP_TYPE.MESH.

◆ allowed_range()

np.array[float] allowed_range (   self)

The maximum depth allowed by spatial mapping:

  • allowed_range.first is the minimum value allowed
  • allowed_range.second is the maximum value allowed

◆ range_meter()

float range_meter (   self)

Depth range in meters.

Can be different from the value set by sl.InitParameters.depth_maximum_distance.

Note
Set to 0 by default. In this case, the range is computed from resolution_meter and from the current internal parameters to fit your application.

◆ allowed_resolution()

np.array[float] allowed_resolution (   self)

The resolution allowed by the spatial mapping:

  • allowed_resolution.first is the minimum value allowed
  • allowed_resolution.second is the maximum value allowed

◆ resolution_meter()

float resolution_meter (   self)

Spatial mapping resolution in meters.

Default: 0.05

Note
It should fit allowed_resolution.

◆ stability_counter()

int stability_counter (   self)

Control the integration rate of the current depth into the mapping process.

This parameter controls how many times a stable 3D points should be seen before it is integrated into the spatial mapping.
Default: 0 (this will define the stability counter based on the mesh resolution, the higher the resolution, the higher the stability counter)

◆ save()

bool save (   self,
str  filename 
)

Saves the current set of parameters into a file to be reloaded with the load() method.

Parameters
filename: Name of the file which will be created to store the parameters (extension '.yml' will be added if not set).
Returns
True if the file was successfully saved, otherwise False.
Warning
For security reasons, the file must not already exist.
In case a file already exists, the method will return False and existing file will not be updated.

◆ load()

bool load (   self,
str  filename 
)

Loads a set of parameters from the values contained in a previously saved file.

Parameters
filename: Path to the file from which the parameters will be loaded (extension '.yml' will be added at the end of the filename if not detected).
Returns
True if the file was successfully loaded, otherwise False.