Mapping API

The Mapping API gives access to fast real-time 3D reconstructions. It can also be used together with Replay API for high-quality post-processed results, which can also be given as inputs to other tools such as Nerfstudio.

OAK-D fast mapping
class spectacularAI.mapping.Frame

A single camera frame with a pose and bitmap image

property cameraPose

CameraPose for this frame

property depthScale

float Scale of depth image, for non-depth images this is -1.0

property image

Bitmap Image data if it exists

property sparseFeatures

List of FeaturePoint. 2D-to-3D sparse feature matches in this frame. Empty if not available for this frame type, e.g., depth frames.

property visualMarkers

List of VisualMarker. Visual Markers detected in this frame. Only April Tags are supported currently. Always empty if April Tag detection is not enabled.

class spectacularAI.mapping.FrameSet

A set of camera frames from multiple cameras at a moment of time.

property depthFrame

Frame The depth camera

getAlignedDepthFrame(self: spectacularAI.mapping.FrameSet, arg0: spectacularAI::mapping::Frame) spectacularAI::mapping::Frame

Compute the depth map at the camera pose of the input frame (for example rgbFrame). If depthFrame is already aligned to the the input camera, returns depthFrame.

getUndistortedFrame(self: spectacularAI.mapping.FrameSet, arg0: spectacularAI::mapping::Frame) spectacularAI::mapping::Frame

Returns an undistorted version of the input frame (i.e., with camera model = undistorted pinhole). If the input frame is not distorted, returns the input frame.

property primaryFrame

Frame The primary camera

property rgbFrame

Frame The RGB camera

property secondaryFrame

Frame The secondary camera

class spectacularAI.mapping.KeyFrame

A SLAM KeyFrame

property angularVelocity

Vector3d Instantaneous angular velocity vector in SI units (rad/s)

property frameSet

FrameSet Cameras for this key frame

property id

int Unique identifier for this key frame

property pointCloud

PointCloud Point cloud for this key frame in primary frame coordinates

class spectacularAI.mapping.Map

A map generated by SLAM

property keyFrames

Dictionary where key is key frame id (int) and value is KeyFrame. All key frames belonging to this map. Contains the entire map from start to this moment.

property mapPoints

Dictionary where key is map point id (int) and value is Vector3d. All sparse map points currently in the map.

class spectacularAI.mapping.MapperOutput

Main mapping output structure

property finalMap

A bool that indicates the map is now final and won’t be updated any longer. This is true the when the program exits.

property map

The current Map

property mesh

Mesh (Optional) dense reconstruction of the map.

property updatedKeyFrames

List of int. Key frame ids that were updated (created, modified or deleted) since the last callback

property updatedMapPoints

List of int. Map points ids that were updated (created, modified or deleted) since the last callback

class spectacularAI.mapping.Mesh

A generic 3D mesh with a few optional properties (e.g., normals).

empty(self: spectacularAI.mapping.Mesh) bool

True when mesh has no vertices

faceCount(self: spectacularAI.mapping.Mesh) int

Number of faces (L)

getFaceNormals(self: spectacularAI.mapping.Mesh) numpy.ndarray[numpy.uint32]

A numpy array of size Lx3 that contains all face normals indices if they exist

getFaceVertices(self: spectacularAI.mapping.Mesh) numpy.ndarray[numpy.uint32]

A numpy array of size Lx3 that contains all face vertex indices.

getNormalData(self: spectacularAI.mapping.Mesh) numpy.ndarray[numpy.float32]

A numpy array of size Mx3 that contains all vertex normals if they exist

getPositionData(self: spectacularAI.mapping.Mesh) numpy.ndarray[numpy.float32]

A numpy array of size Nx3 that contains all vertex positions

hasNormals(self: spectacularAI.mapping.Mesh) bool

True when mesh has normal data

normalCount(self: spectacularAI.mapping.Mesh) int

Number of normals (M)

vertexCount(self: spectacularAI.mapping.Mesh) int

Number of vertices (N)

class spectacularAI.mapping.PointCloud

Point cloud with position, and optional point normal and color data

empty(self: spectacularAI.mapping.PointCloud) bool

True when point cloud has no points

getNormal(self: spectacularAI.mapping.PointCloud, arg0: int) spectacularAI.Vector3f

Get normal of a single point. Check first that normal data exists for this point cloud

getNormalData(self: spectacularAI.mapping.PointCloud) numpy.ndarray[numpy.float32]

A numpy array of size Nx3 that contains all point normals if they exist

getPosition(self: spectacularAI.mapping.PointCloud, arg0: int) spectacularAI.Vector3f

Get position of a single point

getPositionData(self: spectacularAI.mapping.PointCloud) numpy.ndarray[numpy.float32]

A numpy array of size Nx3 that contains all point positions

getRGB24(self: spectacularAI.mapping.PointCloud, arg0: int) List[int[3]]

Get color of a single point. Check first that color data exists for this point cloud

getRGB24Data(self: spectacularAI.mapping.PointCloud) numpy.ndarray[numpy.uint8]

A numpy array of size Nx3 that contains all point colors if they exist

hasColors(self: spectacularAI.mapping.PointCloud) bool

True when point cloud has color data

hasNormals(self: spectacularAI.mapping.PointCloud) bool

True when point cloud has normal data

size(self: spectacularAI.mapping.PointCloud) int

Number of points

class spectacularAI.mapping.VisualMarker

A visual marker observation in a frame. Only April Tags are supported currently. To enable April Tag detection in the SDK, see https://github.com/SpectacularAI/docs/blob/main/pdf/april_tag_instructions.pdf

property center

PixelCoordinates Center of the visual marker in image pixel coordinates

property corners

List of PixelCoordinates. Corners of the visual marker in image pixel coordinates. In visual marker coordinate frame: index 0=bottom-left, 1=bottom-right, 2=top-right, 3=top-left

property hasPose

bool Flag that indicates if marker has pose information. Currently markers with unknown size don’t have pose estimate.

property id

int Visual marker ID

property pose

Pose Camera to visual marker transformation (note: identity if size is not available). The visual marker’s coordinate frame is centered at the center of the marker, with x-axis to the right, y-axis down, and z-axis into the tag.

property size

float Visual marker size in meters (note: 0 if not available)