Show / Hide Table of Contents

Class CascadeClassifier

Cascade classifier class for object detection.

Inheritance
System.Object
DisposableObject
DisposableCvObject
CascadeClassifier
Implements
ICvPtrHolder
Inherited Members
DisposableCvObject.ptr
DisposableCvObject.CvPtr
DisposableObject.DataHandle
DisposableObject.IsDisposed
DisposableObject.IsEnabledDispose
DisposableObject.AllocatedMemory
DisposableObject.AllocatedMemorySize
DisposableObject.Dispose()
DisposableObject.Dispose(Boolean)
DisposableObject.DisposeManaged()
DisposableObject.AllocGCHandle(Object)
DisposableObject.AllocMemory(Int32)
DisposableObject.NotifyMemoryPressure(Int64)
DisposableObject.ThrowIfDisposed()
Namespace: OpenCvSharp
Assembly: OpenCvSharp.dll
Syntax
public class CascadeClassifier : DisposableCvObject, ICvPtrHolder

Constructors

| Improve this Doc View Source

CascadeClassifier()

Default constructor

Declaration
public CascadeClassifier()
| Improve this Doc View Source

CascadeClassifier(String)

Loads a classifier from a file.

Declaration
public CascadeClassifier(string fileName)
Parameters
Type Name Description
System.String fileName

Name of the file from which the classifier is loaded.

Methods

| Improve this Doc View Source

DetectMultiScale(Mat, Double, Int32, HaarDetectionTypes, Nullable<Size>, Nullable<Size>)

Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.

Declaration
public virtual Rect[] DetectMultiScale(Mat image, double scaleFactor = 1.1, int minNeighbors = 3, HaarDetectionTypes flags = (HaarDetectionTypes)0, Size? minSize = null, Size? maxSize = null)
Parameters
Type Name Description
Mat image

Matrix of the type CV_8U containing an image where objects are detected.

System.Double scaleFactor

Parameter specifying how much the image size is reduced at each image scale.

System.Int32 minNeighbors

Parameter specifying how many neighbors each candidate rectangle should have to retain it.

HaarDetectionTypes flags

Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.

System.Nullable<OpenCvSharp.Size> minSize

Minimum possible object size. Objects smaller than that are ignored.

System.Nullable<OpenCvSharp.Size> maxSize

Maximum possible object size. Objects larger than that are ignored.

Returns
Type Description
OpenCvSharp.Rect[]

Vector of rectangles where each rectangle contains the detected object.

| Improve this Doc View Source

DetectMultiScale(Mat, out Int32[], out Double[], Double, Int32, HaarDetectionTypes, Nullable<Size>, Nullable<Size>, Boolean)

Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.

Declaration
public virtual Rect[] DetectMultiScale(Mat image, out int[] rejectLevels, out double[] levelWeights, double scaleFactor = 1.1, int minNeighbors = 3, HaarDetectionTypes flags = (HaarDetectionTypes)0, Size? minSize = null, Size? maxSize = null, bool outputRejectLevels = false)
Parameters
Type Name Description
Mat image

Matrix of the type CV_8U containing an image where objects are detected.

System.Int32[] rejectLevels
System.Double[] levelWeights
System.Double scaleFactor

Parameter specifying how much the image size is reduced at each image scale.

System.Int32 minNeighbors

Parameter specifying how many neighbors each candidate rectangle should have to retain it.

HaarDetectionTypes flags

Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.

System.Nullable<OpenCvSharp.Size> minSize

Minimum possible object size. Objects smaller than that are ignored.

System.Nullable<OpenCvSharp.Size> maxSize

Maximum possible object size. Objects larger than that are ignored.

System.Boolean outputRejectLevels
Returns
Type Description
OpenCvSharp.Rect[]

Vector of rectangles where each rectangle contains the detected object.

| Improve this Doc View Source

DisposeUnmanaged()

Releases unmanaged resources

Declaration
protected override void DisposeUnmanaged()
Overrides
DisposableCvObject.DisposeUnmanaged()
| Improve this Doc View Source

Empty()

Checks whether the classifier has been loaded.

Declaration
public virtual bool Empty()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

GetFeatureType()

Declaration
public int GetFeatureType()
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetOriginalWindowSize()

Declaration
public virtual Size GetOriginalWindowSize()
Returns
Type Description
OpenCvSharp.Size
| Improve this Doc View Source

IsOldFormatCascade()

Declaration
public bool IsOldFormatCascade()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Load(String)

Loads a classifier from a file.

Declaration
public bool Load(string fileName)
Parameters
Type Name Description
System.String fileName

Name of the file from which the classifier is loaded. The file may contain an old HAAR classifier trained by the haartraining application or a new cascade classifier trained by the traincascade application.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

Read(FileNode)

Reads a classifier parameters from a file storage

Declaration
public virtual bool Read(FileNode fn)
Parameters
Type Name Description
FileNode fn
Returns
Type Description
System.Boolean

Implements

ICvPtrHolder
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX