Table of Contents

Class SegmentationModel

Namespace
OpenCvSharp.Dnn
Assembly
OpenCvSharp.dll

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.

public class SegmentationModel : Model, IDisposable
Inheritance
SegmentationModel
Implements
Inherited Members

Constructors

SegmentationModel(Net)

Create model from deep learning network.

public SegmentationModel(Net network)

Parameters

network Net

Net object.

SegmentationModel(string, string?)

Create segmentation model from network represented in one of the supported formats. An order of @p model and @p config arguments does not matter.

public SegmentationModel(string model, string? config = null)

Parameters

model string

Binary file contains trained weights.

config string

Text file contains network configuration.

Methods

Segment(InputArray, OutputArray)

Given the @p input frame, create input blob, run net.

public void Segment(InputArray frame, OutputArray mask)

Parameters

frame InputArray

The input image.

mask OutputArray

Allocated class prediction for each pixel.