Table of Contents

Class GraphSegmentation

Namespace
OpenCvSharp.XImgProc.Segmentation
Assembly
OpenCvSharp.dll

Graph Based Segmentation Algorithm. The class implements the algorithm described in @cite PFF2004.

public class GraphSegmentation : Algorithm, IDisposable, ICvPtrHolder
Inheritance
GraphSegmentation
Implements
Inherited Members

Constructors

GraphSegmentation(nint)

Creates instance by raw pointer

protected GraphSegmentation(nint p)

Parameters

p nint

Properties

K

public virtual float K { get; set; }

Property Value

float

MinSize

public virtual int MinSize { get; set; }

Property Value

int

Sigma

public virtual double Sigma { get; set; }

Property Value

double

Methods

Create(double, float, int)

Creates a graph based segmentor

public static GraphSegmentation Create(double sigma = 0.5, float k = 300, int minSize = 100)

Parameters

sigma double

The sigma parameter, used to smooth image

k float

The k parameter of the algorithm

minSize int

The minimum size of segments

Returns

GraphSegmentation

DisposeManaged()

Releases managed resources

protected override void DisposeManaged()

ProcessImage(InputArray, OutputArray)

Segment an image and store output in dst

public virtual void ProcessImage(InputArray src, OutputArray dst)

Parameters

src InputArray

The input image. Any number of channel (1 (Eg: Gray), 3 (Eg: RGB), 4 (Eg: RGB-D)) can be provided

dst OutputArray

The output segmentation. It's a CV_32SC1 Mat with the same number of cols and rows as input image, with an unique, sequential, id for each pixel.