OpenCV for Unity  2.6.0
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.9.0/index.html ) for the details of the argument of the method.
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
OpenCVForUnity.ObjdetectModule.CascadeClassifier Class Reference

Cascade classifier class for object detection. More...

Inheritance diagram for OpenCVForUnity.ObjdetectModule.CascadeClassifier:
OpenCVForUnity.DisposableOpenCVObject OpenCVForUnity.DisposableObject

Public Member Functions

IntPtr getNativeObjAddr ()
 
 CascadeClassifier ()
 
 CascadeClassifier (string filename)
 Loads a classifier from a file. More...
 
bool empty ()
 Checks whether the classifier has been loaded. More...
 
bool load (string filename)
 Loads a classifier from a file. More...
 
void detectMultiScale (Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
 Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. More...
 
void detectMultiScale (Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags, Size minSize)
 Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. More...
 
void detectMultiScale (Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags)
 Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. More...
 
void detectMultiScale (Mat image, MatOfRect objects, double scaleFactor, int minNeighbors)
 Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. More...
 
void detectMultiScale (Mat image, MatOfRect objects, double scaleFactor)
 Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. More...
 
void detectMultiScale (Mat image, MatOfRect objects)
 Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. More...
 
void detectMultiScale2 (Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
 
void detectMultiScale2 (Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize)
 
void detectMultiScale2 (Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags)
 
void detectMultiScale2 (Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors)
 
void detectMultiScale2 (Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor)
 
void detectMultiScale2 (Mat image, MatOfRect objects, MatOfInt numDetections)
 
void detectMultiScale3 (Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize, bool outputRejectLevels)
 
void detectMultiScale3 (Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
 
void detectMultiScale3 (Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize)
 
void detectMultiScale3 (Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags)
 
void detectMultiScale3 (Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors)
 
void detectMultiScale3 (Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor)
 
void detectMultiScale3 (Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights)
 
bool isOldFormatCascade ()
 
Size getOriginalWindowSize ()
 
int getFeatureType ()
 
- Public Member Functions inherited from OpenCVForUnity.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Static Public Member Functions

static CascadeClassifier __fromPtr__ (IntPtr addr)
 
static bool convert (string oldcascade, string newcascade)
 
- Static Public Member Functions inherited from OpenCVForUnity.DisposableObject
static IntPtr ThrowIfNullIntPtr (IntPtr ptr)
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Properties inherited from OpenCVForUnity.DisposableObject
bool IsDisposed [get, protected set]
 
bool IsEnabledDispose [get, set]
 

Detailed Description

Cascade classifier class for object detection.

Constructor & Destructor Documentation

◆ CascadeClassifier() [1/2]

OpenCVForUnity.ObjdetectModule.CascadeClassifier.CascadeClassifier ( )

◆ CascadeClassifier() [2/2]

OpenCVForUnity.ObjdetectModule.CascadeClassifier.CascadeClassifier ( string  filename)

Loads a classifier from a file.

Parameters
filenameName of the file from which the classifier is loaded.

Member Function Documentation

◆ __fromPtr__()

static CascadeClassifier OpenCVForUnity.ObjdetectModule.CascadeClassifier.__fromPtr__ ( IntPtr  addr)
static

◆ convert()

static bool OpenCVForUnity.ObjdetectModule.CascadeClassifier.convert ( string  oldcascade,
string  newcascade 
)
static

◆ detectMultiScale() [1/6]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale ( Mat  image,
MatOfRect  objects,
double  scaleFactor,
int  minNeighbors,
int  flags,
Size  minSize,
Size  maxSize 
)

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

Parameters
imageMatrix of the type CV_8U containing an image where objects are detected.
objectsVector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
scaleFactorParameter specifying how much the image size is reduced at each image scale.
minNeighborsParameter specifying how many neighbors each candidate rectangle should have to retain it.
flagsParameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSizeMinimum possible object size. Objects smaller than that are ignored.
maxSizeMaximum possible object size. Objects larger than that are ignored. If maxSize == minSize model is evaluated on single scale.

◆ detectMultiScale() [2/6]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale ( Mat  image,
MatOfRect  objects,
double  scaleFactor,
int  minNeighbors,
int  flags,
Size  minSize 
)

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

Parameters
imageMatrix of the type CV_8U containing an image where objects are detected.
objectsVector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
scaleFactorParameter specifying how much the image size is reduced at each image scale.
minNeighborsParameter specifying how many neighbors each candidate rectangle should have to retain it.
flagsParameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSizeMinimum possible object size. Objects smaller than that are ignored.
maxSizeMaximum possible object size. Objects larger than that are ignored. If maxSize == minSize model is evaluated on single scale.

◆ detectMultiScale() [3/6]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale ( Mat  image,
MatOfRect  objects,
double  scaleFactor,
int  minNeighbors,
int  flags 
)

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

Parameters
imageMatrix of the type CV_8U containing an image where objects are detected.
objectsVector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
scaleFactorParameter specifying how much the image size is reduced at each image scale.
minNeighborsParameter specifying how many neighbors each candidate rectangle should have to retain it.
flagsParameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSizeMinimum possible object size. Objects smaller than that are ignored.
maxSizeMaximum possible object size. Objects larger than that are ignored. If maxSize == minSize model is evaluated on single scale.

◆ detectMultiScale() [4/6]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale ( Mat  image,
MatOfRect  objects,
double  scaleFactor,
int  minNeighbors 
)

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

Parameters
imageMatrix of the type CV_8U containing an image where objects are detected.
objectsVector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
scaleFactorParameter specifying how much the image size is reduced at each image scale.
minNeighborsParameter specifying how many neighbors each candidate rectangle should have to retain it.
flagsParameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSizeMinimum possible object size. Objects smaller than that are ignored.
maxSizeMaximum possible object size. Objects larger than that are ignored. If maxSize == minSize model is evaluated on single scale.

◆ detectMultiScale() [5/6]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale ( Mat  image,
MatOfRect  objects,
double  scaleFactor 
)

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

Parameters
imageMatrix of the type CV_8U containing an image where objects are detected.
objectsVector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
scaleFactorParameter specifying how much the image size is reduced at each image scale.
minNeighborsParameter specifying how many neighbors each candidate rectangle should have to retain it.
flagsParameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSizeMinimum possible object size. Objects smaller than that are ignored.
maxSizeMaximum possible object size. Objects larger than that are ignored. If maxSize == minSize model is evaluated on single scale.

◆ detectMultiScale() [6/6]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale ( Mat  image,
MatOfRect  objects 
)

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

Parameters
imageMatrix of the type CV_8U containing an image where objects are detected.
objectsVector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
scaleFactorParameter specifying how much the image size is reduced at each image scale.
minNeighborsParameter specifying how many neighbors each candidate rectangle should have to retain it.
flagsParameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSizeMinimum possible object size. Objects smaller than that are ignored.
maxSizeMaximum possible object size. Objects larger than that are ignored. If maxSize == minSize model is evaluated on single scale.

◆ detectMultiScale2() [1/6]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale2 ( Mat  image,
MatOfRect  objects,
MatOfInt  numDetections,
double  scaleFactor,
int  minNeighbors,
int  flags,
Size  minSize,
Size  maxSize 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
imageMatrix of the type CV_8U containing an image where objects are detected.
objectsVector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
numDetectionsVector of detection numbers for the corresponding objects. An object's number of detections is the number of neighboring positively classified rectangles that were joined together to form the object.
scaleFactorParameter specifying how much the image size is reduced at each image scale.
minNeighborsParameter specifying how many neighbors each candidate rectangle should have to retain it.
flagsParameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSizeMinimum possible object size. Objects smaller than that are ignored.
maxSizeMaximum possible object size. Objects larger than that are ignored. If maxSize == minSize model is evaluated on single scale.

◆ detectMultiScale2() [2/6]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale2 ( Mat  image,
MatOfRect  objects,
MatOfInt  numDetections,
double  scaleFactor,
int  minNeighbors,
int  flags,
Size  minSize 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
imageMatrix of the type CV_8U containing an image where objects are detected.
objectsVector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
numDetectionsVector of detection numbers for the corresponding objects. An object's number of detections is the number of neighboring positively classified rectangles that were joined together to form the object.
scaleFactorParameter specifying how much the image size is reduced at each image scale.
minNeighborsParameter specifying how many neighbors each candidate rectangle should have to retain it.
flagsParameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSizeMinimum possible object size. Objects smaller than that are ignored.
maxSizeMaximum possible object size. Objects larger than that are ignored. If maxSize == minSize model is evaluated on single scale.

◆ detectMultiScale2() [3/6]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale2 ( Mat  image,
MatOfRect  objects,
MatOfInt  numDetections,
double  scaleFactor,
int  minNeighbors,
int  flags 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
imageMatrix of the type CV_8U containing an image where objects are detected.
objectsVector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
numDetectionsVector of detection numbers for the corresponding objects. An object's number of detections is the number of neighboring positively classified rectangles that were joined together to form the object.
scaleFactorParameter specifying how much the image size is reduced at each image scale.
minNeighborsParameter specifying how many neighbors each candidate rectangle should have to retain it.
flagsParameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSizeMinimum possible object size. Objects smaller than that are ignored.
maxSizeMaximum possible object size. Objects larger than that are ignored. If maxSize == minSize model is evaluated on single scale.

◆ detectMultiScale2() [4/6]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale2 ( Mat  image,
MatOfRect  objects,
MatOfInt  numDetections,
double  scaleFactor,
int  minNeighbors 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
imageMatrix of the type CV_8U containing an image where objects are detected.
objectsVector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
numDetectionsVector of detection numbers for the corresponding objects. An object's number of detections is the number of neighboring positively classified rectangles that were joined together to form the object.
scaleFactorParameter specifying how much the image size is reduced at each image scale.
minNeighborsParameter specifying how many neighbors each candidate rectangle should have to retain it.
flagsParameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSizeMinimum possible object size. Objects smaller than that are ignored.
maxSizeMaximum possible object size. Objects larger than that are ignored. If maxSize == minSize model is evaluated on single scale.

◆ detectMultiScale2() [5/6]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale2 ( Mat  image,
MatOfRect  objects,
MatOfInt  numDetections,
double  scaleFactor 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
imageMatrix of the type CV_8U containing an image where objects are detected.
objectsVector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
numDetectionsVector of detection numbers for the corresponding objects. An object's number of detections is the number of neighboring positively classified rectangles that were joined together to form the object.
scaleFactorParameter specifying how much the image size is reduced at each image scale.
minNeighborsParameter specifying how many neighbors each candidate rectangle should have to retain it.
flagsParameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSizeMinimum possible object size. Objects smaller than that are ignored.
maxSizeMaximum possible object size. Objects larger than that are ignored. If maxSize == minSize model is evaluated on single scale.

◆ detectMultiScale2() [6/6]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale2 ( Mat  image,
MatOfRect  objects,
MatOfInt  numDetections 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
imageMatrix of the type CV_8U containing an image where objects are detected.
objectsVector of rectangles where each rectangle contains the detected object, the rectangles may be partially outside the original image.
numDetectionsVector of detection numbers for the corresponding objects. An object's number of detections is the number of neighboring positively classified rectangles that were joined together to form the object.
scaleFactorParameter specifying how much the image size is reduced at each image scale.
minNeighborsParameter specifying how many neighbors each candidate rectangle should have to retain it.
flagsParameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
minSizeMinimum possible object size. Objects smaller than that are ignored.
maxSizeMaximum possible object size. Objects larger than that are ignored. If maxSize == minSize model is evaluated on single scale.

◆ detectMultiScale3() [1/7]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale3 ( Mat  image,
MatOfRect  objects,
MatOfInt  rejectLevels,
MatOfDouble  levelWeights,
double  scaleFactor,
int  minNeighbors,
int  flags,
Size  minSize,
Size  maxSize,
bool  outputRejectLevels 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function allows you to retrieve the final stage decision certainty of classification. For this, one needs to set outputRejectLevels on true and provide the rejectLevels and levelWeights parameter. For each resulting detection, levelWeights will then contain the certainty of classification at the final stage. This value can then be used to separate strong from weaker classifications.

A code sample on how to use it efficiently can be found below:

Mat img;
vector<double> weights;
vector<int> levels;
vector<Rect> detections;
CascadeClassifier model("/path/to/your/model.xml");
model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true);
cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl;

◆ detectMultiScale3() [2/7]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale3 ( Mat  image,
MatOfRect  objects,
MatOfInt  rejectLevels,
MatOfDouble  levelWeights,
double  scaleFactor,
int  minNeighbors,
int  flags,
Size  minSize,
Size  maxSize 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function allows you to retrieve the final stage decision certainty of classification. For this, one needs to set outputRejectLevels on true and provide the rejectLevels and levelWeights parameter. For each resulting detection, levelWeights will then contain the certainty of classification at the final stage. This value can then be used to separate strong from weaker classifications.

A code sample on how to use it efficiently can be found below:

Mat img;
vector<double> weights;
vector<int> levels;
vector<Rect> detections;
CascadeClassifier model("/path/to/your/model.xml");
model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true);
cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl;

◆ detectMultiScale3() [3/7]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale3 ( Mat  image,
MatOfRect  objects,
MatOfInt  rejectLevels,
MatOfDouble  levelWeights,
double  scaleFactor,
int  minNeighbors,
int  flags,
Size  minSize 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function allows you to retrieve the final stage decision certainty of classification. For this, one needs to set outputRejectLevels on true and provide the rejectLevels and levelWeights parameter. For each resulting detection, levelWeights will then contain the certainty of classification at the final stage. This value can then be used to separate strong from weaker classifications.

A code sample on how to use it efficiently can be found below:

Mat img;
vector<double> weights;
vector<int> levels;
vector<Rect> detections;
CascadeClassifier model("/path/to/your/model.xml");
model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true);
cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl;

◆ detectMultiScale3() [4/7]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale3 ( Mat  image,
MatOfRect  objects,
MatOfInt  rejectLevels,
MatOfDouble  levelWeights,
double  scaleFactor,
int  minNeighbors,
int  flags 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function allows you to retrieve the final stage decision certainty of classification. For this, one needs to set outputRejectLevels on true and provide the rejectLevels and levelWeights parameter. For each resulting detection, levelWeights will then contain the certainty of classification at the final stage. This value can then be used to separate strong from weaker classifications.

A code sample on how to use it efficiently can be found below:

Mat img;
vector<double> weights;
vector<int> levels;
vector<Rect> detections;
CascadeClassifier model("/path/to/your/model.xml");
model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true);
cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl;

◆ detectMultiScale3() [5/7]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale3 ( Mat  image,
MatOfRect  objects,
MatOfInt  rejectLevels,
MatOfDouble  levelWeights,
double  scaleFactor,
int  minNeighbors 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function allows you to retrieve the final stage decision certainty of classification. For this, one needs to set outputRejectLevels on true and provide the rejectLevels and levelWeights parameter. For each resulting detection, levelWeights will then contain the certainty of classification at the final stage. This value can then be used to separate strong from weaker classifications.

A code sample on how to use it efficiently can be found below:

Mat img;
vector<double> weights;
vector<int> levels;
vector<Rect> detections;
CascadeClassifier model("/path/to/your/model.xml");
model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true);
cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl;

◆ detectMultiScale3() [6/7]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale3 ( Mat  image,
MatOfRect  objects,
MatOfInt  rejectLevels,
MatOfDouble  levelWeights,
double  scaleFactor 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function allows you to retrieve the final stage decision certainty of classification. For this, one needs to set outputRejectLevels on true and provide the rejectLevels and levelWeights parameter. For each resulting detection, levelWeights will then contain the certainty of classification at the final stage. This value can then be used to separate strong from weaker classifications.

A code sample on how to use it efficiently can be found below:

Mat img;
vector<double> weights;
vector<int> levels;
vector<Rect> detections;
CascadeClassifier model("/path/to/your/model.xml");
model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true);
cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl;

◆ detectMultiScale3() [7/7]

void OpenCVForUnity.ObjdetectModule.CascadeClassifier.detectMultiScale3 ( Mat  image,
MatOfRect  objects,
MatOfInt  rejectLevels,
MatOfDouble  levelWeights 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This function allows you to retrieve the final stage decision certainty of classification. For this, one needs to set outputRejectLevels on true and provide the rejectLevels and levelWeights parameter. For each resulting detection, levelWeights will then contain the certainty of classification at the final stage. This value can then be used to separate strong from weaker classifications.

A code sample on how to use it efficiently can be found below:

Mat img;
vector<double> weights;
vector<int> levels;
vector<Rect> detections;
CascadeClassifier model("/path/to/your/model.xml");
model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true);
cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl;

◆ Dispose()

override void OpenCVForUnity.ObjdetectModule.CascadeClassifier.Dispose ( bool  disposing)
protectedvirtual

◆ empty()

bool OpenCVForUnity.ObjdetectModule.CascadeClassifier.empty ( )

Checks whether the classifier has been loaded.

◆ getFeatureType()

int OpenCVForUnity.ObjdetectModule.CascadeClassifier.getFeatureType ( )

◆ getNativeObjAddr()

IntPtr OpenCVForUnity.ObjdetectModule.CascadeClassifier.getNativeObjAddr ( )

◆ getOriginalWindowSize()

Size OpenCVForUnity.ObjdetectModule.CascadeClassifier.getOriginalWindowSize ( )

◆ isOldFormatCascade()

bool OpenCVForUnity.ObjdetectModule.CascadeClassifier.isOldFormatCascade ( )

◆ load()

bool OpenCVForUnity.ObjdetectModule.CascadeClassifier.load ( string  filename)

Loads a classifier from a file.

Parameters
filenameName 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.

The documentation for this class was generated from the following file: