Skip to content

triangleRasterizeDepth

ptcloudfunctionOpenCV 5.0.0
import { triangleRasterizeDepth } from '@banou/opencv-wasm'

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

ARGUMENTSvertices, indices, depthBuf, world2cam
FUNCTIONtriangleRasterizeDepth
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Overloaded version of triangleRasterize() with depth-only rendering

triangleRasterizeDepth(vertices: Mat, indices: Mat, depthBuf: Mat, world2cam: Mat, fovY: number, zNear: number, zFar: number, settings: TriangleRasterizeSettings): void;
2 available overloads
triangleRasterizeDepth(vertices: Mat, indices: Mat, depthBuf: Mat, world2cam: Mat, fovY: number, zNear: number, zFar: number): void;
triangleRasterizeDepth(vertices: Mat, indices: Mat, depthBuf: Mat, world2cam: Mat, fovY: number, zNear: number, zFar: number, settings: TriangleRasterizeSettings): void;
vertices

vertices coordinates array. Should contain values of CV_32FC3 type or a compatible one (e.g. cv::Vec3f, etc.)

indices

triangle vertices index array, 3 per triangle. Each index indicates a vertex in a vertices array. Should contain CV_32SC3 values or compatible

depthBuf

Input/output value, modified by the native operation. an array of floats containing resulting Z buffer. Should contain float values and be the same size as colorBuf. Not cleared before rendering, i.e. the content is reused as there is some pre-rendered scene. Empty scene corresponds to all values set to zFar (or to 1.0 in INVDEPTH mode)

world2cam

a 4x3 or 4x4 float or double matrix containing inverted (sic!) camera pose

fovY

field of view in vertical direction, given in radians

zNear

minimum Z value to render, everything closer is clipped

zFar

maximum Z value to render, everything farther is clipped

settings

see TriangleRasterizeSettings. By default the smooth shading is on, with CW culling and with disabled GL compatibility

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.