dnn_SegmentationModel
import { dnn_SegmentationModel } 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. Inherits dnn_Model.
This class represents high-level API for segmentation models
SegmentationModel allows to set params for preprocessing input image. SegmentationModel creates net from file with trained weights and config, sets preprocessing input, runs forward pass and returns the class prediction for each pixel.
Constructors and members
static new
Create segmentation model from network represented in one of the supported formats.
An order of model and config arguments does not matter.
new(model: EmbindString, config: EmbindString): dnn_SegmentationModel;2 available overloads
new(network: EmbindString): dnn_SegmentationModel;new(model: EmbindString, config: EmbindString): dnn_SegmentationModel;networkNet object.
modelBinary file contains trained weights.
configText file contains network configuration.
The dnn_SegmentationModel result.
static from1
Create an owned dnn_SegmentationModel instance with the supplied configuration.
This class represents high-level API for segmentation models
from1(_0: dnn_Net): dnn_SegmentationModel | null;_00 argument (dnn_Net).
The dnn_SegmentationModel | 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.
segment
Given the input frame, create input blob, run net
segment(frame: Mat, mask: Mat): void;frameThe input image.
maskOutput destination, filled by the native operation. Allocated class prediction for each pixel
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.