Skip to content

Volume

ptcloudclassOpenCV 5.0.0
import { Volume } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSConstructor or factory
CLASSVolume
RETURN TYPEOwned native handle
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Native object: release it with using or delete(). Factories can return null; check before calling methods.

volume value in the OpenCV API.

Constructors and members

static new

Constructor of custom volume.

new(vtype: VolumeType, settings: VolumeSettings): Volume;
3 available overloads
new(): Volume;
new(vtype: VolumeType): Volume;
new(vtype: VolumeType, settings: VolumeSettings): Volume;
vtype

the volume type [TSDF, HashTSDF, ColorTSDF].

settings

the custom settings for volume.

Returns

The Volume result.

clone

Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.

clone(): this;
Returns

The this result.

integrateFrame

Integrates the input data to the volume.

Camera intrinsics are taken from volume settings structure.
integrateFrame(frame: OdometryFrame, pose: Mat): void;
frame

the object from which to take depth and image data. For color TSDF a depth data should be registered with color data, i.e. have the same intrinsics & camera pose. This can be done using function registerDepth() from 3d module.

pose

the pose of camera in global coordinates.

integrate

Integrates the input data to the volume.

Camera intrinsics are taken from volume settings structure.
integrate(depth: Mat, pose: Mat): void;
depth

the depth image.

pose

the pose of camera in global coordinates.

integrateColor

Integrates the input data to the volume.

Camera intrinsics are taken from volume settings structure.
integrateColor(depth: Mat, image: Mat, pose: Mat): void;
depth

the depth image.

image

the color image (only for ColorTSDF). For color TSDF a depth data should be registered with color data, i.e. have the same intrinsics & camera pose. This can be done using function registerDepth() from 3d module.

pose

the pose of camera in global coordinates.

raycast

Python bindings do not process noArray() default argument correctly, so the raycast() method is repeated several times Renders the volume contents into an image. The resulting points and normals are in camera's coordinate system.

Rendered image size and camera intrinsics are taken from volume settings structure.
raycast(cameraPose: Mat, points: Mat, normals: Mat): void;
cameraPose

the pose of camera in global coordinates.

points

Output destination, filled by the native operation. image to store rendered points.

normals

Output destination, filled by the native operation. image to store rendered normals corresponding to points.

raycastColor

Renders the volume contents into an image. The resulting points and normals are in camera's coordinate system.

Rendered image size and camera intrinsics are taken from volume settings structure.
raycastColor(cameraPose: Mat, points: Mat, normals: Mat, colors: Mat): void;
cameraPose

the pose of camera in global coordinates.

points

Output destination, filled by the native operation. image to store rendered points.

normals

Output destination, filled by the native operation. image to store rendered normals corresponding to points.

colors

Output destination, filled by the native operation. image to store rendered colors corresponding to points (only for ColorTSDF).

raycastEx

Renders the volume contents into an image. The resulting points and normals are in camera's coordinate system.

Rendered image size and camera intrinsics are taken from volume settings structure.
raycastEx(cameraPose: Mat, height: number, width: number, K: Mat, points: Mat, normals: Mat): void;
cameraPose

the pose of camera in global coordinates.

height

the height of result image

width

the width of result image

K

camera raycast intrinsics

points

Output destination, filled by the native operation. image to store rendered points.

normals

Output destination, filled by the native operation. image to store rendered normals corresponding to points.

raycastExColor

Renders the volume contents into an image. The resulting points and normals are in camera's coordinate system.

Rendered image size and camera intrinsics are taken from volume settings structure.
raycastExColor(cameraPose: Mat, height: number, width: number, K: Mat, points: Mat, normals: Mat, colors: Mat): void;
cameraPose

the pose of camera in global coordinates.

height

the height of result image

width

the width of result image

K

camera raycast intrinsics

points

Output destination, filled by the native operation. image to store rendered points.

normals

Output destination, filled by the native operation. image to store rendered normals corresponding to points.

colors

Output destination, filled by the native operation. image to store rendered colors corresponding to points (only for ColorTSDF).

fetchNormals

Extract the all data from volume.

fetchNormals(points: Mat, normals: Mat): void;
points

the input exist point.

normals

Output destination, filled by the native operation. the storage of normals (corresponding to input points) in the image.

fetchPointsNormals

Extract the all data from volume.

fetchPointsNormals(points: Mat, normals: Mat): void;
points

Output destination, filled by the native operation. the storage of all points.

normals

Output destination, filled by the native operation. the storage of all normals, corresponding to points.

fetchPointsNormalsColors

Extract the all data from volume.

fetchPointsNormalsColors(points: Mat, normals: Mat, colors: Mat): void;
points

Output destination, filled by the native operation. the storage of all points.

normals

Output destination, filled by the native operation. the storage of all normals, corresponding to points.

colors

Output destination, filled by the native operation. the storage of all colors, corresponding to points (only for ColorTSDF).

reset

clear all data in volume.

reset(): void;

getVisibleBlocks

TODO: remove this return visible blocks in volume.

getVisibleBlocks(): number;
Returns

The number result.

getTotalVolumeUnits

return number of volume units in volume.

getTotalVolumeUnits(): number;
Returns

The number result.

getBoundingBox

Gets bounding box in volume coordinates with given precision: VOLUME_UNIT - up to volume unit VOXEL - up to voxel (currently not supported)

getBoundingBox(bb: Mat, precision: number): void;
bb

Output destination, filled by the native operation. 6-float 1d array containing (min_x, min_y, min_z, max_x, max_y, max_z) in volume coordinates

precision

bounding box calculation precision

setEnableGrowth

Enables or disables new volume unit allocation during integration. Makes sense for HashTSDF only.

setEnableGrowth(v: boolean): void;
v

v argument (boolean).

getEnableGrowth

Returns if new volume units are allocated during integration or not. Makes sense for HashTSDF only.

getEnableGrowth(): boolean;
Returns

The boolean result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.