Table of Contents

Class CascadeClassifier

Namespace
Emgu.CV
Assembly
Emgu.CV.dll

The Cascade Classifier

public class CascadeClassifier : UnmanagedObject, IDisposable
Inheritance
CascadeClassifier
Implements
Inherited Members

Constructors

CascadeClassifier()

Create a cascade classifier

public CascadeClassifier()

CascadeClassifier(string)

Create a CascadeClassifier from the specific file

public CascadeClassifier(string fileName)

Parameters

fileName string

The name of the file that contains the CascadeClassifier

Properties

IsOldFormatCascade

Get if the cascade is old format

public bool IsOldFormatCascade { get; }

Property Value

bool

OriginalWindowSize

Get the original window size

public Size OriginalWindowSize { get; }

Property Value

Size

Methods

DetectMultiScale(IInputArray, double, int, Size, Size)

Finds rectangular regions in the given image that are likely to contain objects the cascade has been trained for and returns those regions as a sequence of rectangles. The function scans the image several times at different scales. Each time it considers overlapping regions in the image. It may also apply some heuristics to reduce number of analyzed regions, such as Canny prunning. After it has proceeded and collected the candidate rectangles (regions that passed the classifier cascade), it groups them and returns a sequence of average rectangles for each large enough group.

public Rectangle[] DetectMultiScale(IInputArray image, double scaleFactor = 1.1, int minNeighbors = 3, Size minSize = default, Size maxSize = default)

Parameters

image IInputArray

The image where the objects are to be detected from

scaleFactor double

The factor by which the search window is scaled between the subsequent scans, for example, 1.1 means increasing window by 10%

minNeighbors int

Minimum number (minus 1) of neighbor rectangles that makes up an object. All the groups of a smaller number of rectangles than min_neighbors-1 are rejected. If min_neighbors is 0, the function does not any grouping at all and returns all the detected candidate rectangles, which may be useful if the user wants to apply a customized grouping procedure. Use 3 for default.

minSize Size

Minimum window size. Use Size.Empty for default, where it is set to the size of samples the classifier has been trained on (~20x20 for face detection)

maxSize Size

Maximum window size. Use Size.Empty for default, where the parameter will be ignored.

Returns

Rectangle[]

The objects detected, one array per channel

DisposeObject()

Release the CascadeClassifier Object and all the memory associate with it

protected override void DisposeObject()

Read(FileNode)

Load the cascade classifier from a file node

public bool Read(FileNode node)

Parameters

node FileNode

The file node, The file may contain a new cascade classifier only.

Returns

bool

True if the classifier can be imported.