colored_kinfu_ColoredKinFu
import { colored_kinfu_ColoredKinFu } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Native object: release it with using or delete(). Factories can return null; check before calling methods.
KinectFusion implementation
This class implements a 3d reconstruction algorithm described in [kinectfusion] paper.
It takes a sequence of depth images taken from depth sensor (or any depth images source such as stereo camera matching algorithm or even raymarching renderer). The output can be obtained as a vector of points and their normals or can be Phong-rendered from given camera pose.
An internal representation of a model is a voxel cuboid that keeps TSDF values which are a sort of distances to the surface (for details read the [kinectfusion] article about TSDF). There is no interface to that representation yet.
KinFu uses OpenCL acceleration automatically if available. To enable or disable it explicitly use cv::setUseOptimized() or cv::ocl::setUseOpenCL().
This implementation is based on kinfu-remake.
Note that the KinectFusion algorithm was patented and its use may be restricted by the list of patents mentioned in README.md file in this module directory.
That's why you need to set the OPENCV_ENABLE_NONFREE option in CMake to use KinectFusion.
Constructors and members
static create
Create an owned colored_kinfu_ColoredKinFu instance with the supplied configuration.
KinectFusion implementation
create(_params: colored_kinfu_Params | null): colored_kinfu_ColoredKinFu | null;_paramsparams argument (colored_kinfu_Params | null).
The colored_kinfu_ColoredKinFu | null 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;The this result.
render
Renders a volume into an image
Renders a 0-surface of TSDF using Phong shading into a CV_8UC4 Mat.
Light pose is fixed in KinFu params.
render(image: Mat): void;imageOutput destination, filled by the native operation. resulting image
render1
Renders a volume into an image
Renders a 0-surface of TSDF using Phong shading into a CV_8UC4 Mat.
Light pose is fixed in KinFu params.
render1(image: Mat, cameraPose: Matx44f): void;imageOutput destination, filled by the native operation. resulting image
cameraPosepose of camera to render from. If empty then render from current pose which is a last frame camera pose.
getCloud
Gets points and normals of current 3d mesh
The order of normals corresponds to order of points.
The order of points is undefined.
getCloud(points: Mat, normals: Mat): void;pointsOutput destination, filled by the native operation. vector of points which are 4-float vectors
normalsOutput destination, filled by the native operation. vector of normals which are 4-float vectors
getPoints
Gets points of current 3d mesh
The order of points is undefined.
getPoints(points: Mat): void;pointsOutput destination, filled by the native operation. vector of points which are 4-float vectors
getNormals
Calculates normals for given points
getNormals(points: Mat, normals: Mat): void;pointsinput vector of points which are 4-float vectors
normalsOutput destination, filled by the native operation. output vector of corresponding normals which are 4-float vectors
reset
Resets the algorithm
Clears current model and resets a pose.
reset(): void;update
Process next depth frame
update(depth: Mat, rgb: Mat): boolean;depthinput Mat of depth frame
rgbinput Mat of rgb (colored) frame
true if succeeded to align new frame with current scene, false if opposite
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.