EstervQrCode 1.1.1
Library for qr code manipulation
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
cv::CascadeClassifier Class Reference

Cascade classifier class for object detection. More...

#include <objdetect.hpp>

Public Member Functions

CV_WRAP CascadeClassifier ()
 
CV_WRAP CascadeClassifier (const String &filename)
 Loads a classifier from a file. More...
 
 ~CascadeClassifier ()
 
CV_WRAP bool empty () const
 Checks whether the classifier has been loaded. More...
 
CV_WRAP bool load (const String &filename)
 Loads a classifier from a file. More...
 
CV_WRAP bool read (const FileNode &node)
 Reads a classifier from a FileStorage node. More...
 
CV_WRAP void detectMultiScale (InputArray image, CV_OUT std::vector< Rect > &objects, double scaleFactor=1.1, int minNeighbors=3, int flags=0, Size minSize=Size(), Size maxSize=Size())
 Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. More...
 
 CV_WRAP_AS (detectMultiScale2) void detectMultiScale(InputArray image
 
 CV_WRAP_AS (detectMultiScale3) void detectMultiScale(InputArray image
 
CV_WRAP bool isOldFormatCascade () const
 
CV_WRAP Size getOriginalWindowSize () const
 
CV_WRAP int getFeatureType () const
 
void * getOldCascade ()
 
void setMaskGenerator (const Ptr< BaseCascadeClassifier::MaskGenerator > &maskGenerator)
 
Ptr< BaseCascadeClassifier::MaskGeneratorgetMaskGenerator ()
 

Static Public Member Functions

static CV_WRAP bool convert (const String &oldcascade, const String &newcascade)
 

Public Attributes

CV_OUT std::vector< Rect > & objects
 
CV_OUT std::vector< Rect > CV_OUT std::vector< int > & numDetections
 
CV_OUT std::vector< Rect > CV_OUT std::vector< int > double scaleFactor =1.1
 
CV_OUT std::vector< Rect > CV_OUT std::vector< int > double int minNeighbors =3
 
CV_OUT std::vector< Rect > CV_OUT std::vector< int > double int int flags =0
 
CV_OUT std::vector< Rect > CV_OUT std::vector< int > double int int Size minSize =Size()
 
CV_OUT std::vector< Rect > CV_OUT std::vector< int > double int int Size Size maxSize =Size() )
 
CV_OUT std::vector< Rect > CV_OUT std::vector< int > & rejectLevels
 
CV_OUT std::vector< Rect > CV_OUT std::vector< int > CV_OUT std::vector< double > & levelWeights
 
CV_OUT std::vector< Rect > CV_OUT std::vector< int > CV_OUT std::vector< double > double scaleFactor = 1.1
 
CV_OUT std::vector< Rect > CV_OUT std::vector< int > CV_OUT std::vector< double > double int minNeighbors = 3
 
CV_OUT std::vector< Rect > CV_OUT std::vector< int > CV_OUT std::vector< double > double int int flags = 0
 
CV_OUT std::vector< Rect > CV_OUT std::vector< int > CV_OUT std::vector< double > double int int Size minSize = Size()
 
CV_OUT std::vector< Rect > CV_OUT std::vector< int > CV_OUT std::vector< double > double int int Size Size maxSize = Size()
 
CV_OUT std::vector< Rect > CV_OUT std::vector< int > CV_OUT std::vector< double > double int int Size Size bool outputRejectLevels = false )
 
Ptr< BaseCascadeClassifiercc
 

Detailed Description

Cascade classifier class for object detection.

Constructor & Destructor Documentation

◆ CascadeClassifier() [1/2]

CV_WRAP cv::CascadeClassifier::CascadeClassifier ( )

◆ CascadeClassifier() [2/2]

CV_WRAP cv::CascadeClassifier::CascadeClassifier ( const String filename)

Loads a classifier from a file.

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

◆ ~CascadeClassifier()

cv::CascadeClassifier::~CascadeClassifier ( )

Member Function Documentation

◆ convert()

static CV_WRAP bool cv::CascadeClassifier::convert ( const String oldcascade,
const String newcascade 
)
static

◆ CV_WRAP_AS() [1/2]

cv::CascadeClassifier::CV_WRAP_AS ( detectMultiScale2  )

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.

◆ CV_WRAP_AS() [2/2]

cv::CascadeClassifier::CV_WRAP_AS ( detectMultiScale3  )

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;
CV_WRAP CascadeClassifier()
Size2i Size
Definition: types.hpp:370
QTextStream & endl(QTextStream &stream)

◆ detectMultiScale()

CV_WRAP void cv::CascadeClassifier::detectMultiScale ( InputArray  image,
CV_OUT std::vector< Rect > &  objects,
double  scaleFactor = 1.1,
int  minNeighbors = 3,
int  flags = 0,
Size  minSize = Size(),
Size  maxSize = Size() 
)

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.

◆ empty()

CV_WRAP bool cv::CascadeClassifier::empty ( ) const

Checks whether the classifier has been loaded.

◆ getFeatureType()

CV_WRAP int cv::CascadeClassifier::getFeatureType ( ) const

◆ getMaskGenerator()

Ptr<BaseCascadeClassifier::MaskGenerator> cv::CascadeClassifier::getMaskGenerator ( )

◆ getOldCascade()

void* cv::CascadeClassifier::getOldCascade ( )

◆ getOriginalWindowSize()

CV_WRAP Size cv::CascadeClassifier::getOriginalWindowSize ( ) const

◆ isOldFormatCascade()

CV_WRAP bool cv::CascadeClassifier::isOldFormatCascade ( ) const

◆ load()

CV_WRAP bool cv::CascadeClassifier::load ( const 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.

◆ read()

CV_WRAP bool cv::CascadeClassifier::read ( const FileNode node)

Reads a classifier from a FileStorage node.

Note
The file may contain a new cascade classifier (trained by the traincascade application) only.

◆ setMaskGenerator()

void cv::CascadeClassifier::setMaskGenerator ( const Ptr< BaseCascadeClassifier::MaskGenerator > &  maskGenerator)

Member Data Documentation

◆ cc

Ptr<BaseCascadeClassifier> cv::CascadeClassifier::cc

◆ flags [1/2]

CV_OUT std::vector<Rect> CV_OUT std::vector<int> double int int cv::CascadeClassifier::flags =0

◆ flags [2/2]

CV_OUT std::vector<Rect> CV_OUT std::vector<int> CV_OUT std::vector<double> double int int cv::CascadeClassifier::flags = 0

◆ levelWeights

CV_OUT std::vector<Rect> CV_OUT std::vector<int> CV_OUT std::vector<double>& cv::CascadeClassifier::levelWeights

◆ maxSize [1/2]

CV_OUT std::vector<Rect> CV_OUT std::vector<int> double int int Size Size cv::CascadeClassifier::maxSize =Size() )

◆ maxSize [2/2]

CV_OUT std::vector<Rect> CV_OUT std::vector<int> CV_OUT std::vector<double> double int int Size Size cv::CascadeClassifier::maxSize = Size()

◆ minNeighbors [1/2]

CV_OUT std::vector<Rect> CV_OUT std::vector<int> double int cv::CascadeClassifier::minNeighbors =3

◆ minNeighbors [2/2]

CV_OUT std::vector<Rect> CV_OUT std::vector<int> CV_OUT std::vector<double> double int cv::CascadeClassifier::minNeighbors = 3

◆ minSize [1/2]

CV_OUT std::vector<Rect> CV_OUT std::vector<int> double int int Size cv::CascadeClassifier::minSize =Size()

◆ minSize [2/2]

CV_OUT std::vector<Rect> CV_OUT std::vector<int> CV_OUT std::vector<double> double int int Size cv::CascadeClassifier::minSize = Size()

◆ numDetections

CV_OUT std::vector<Rect> CV_OUT std::vector<int>& cv::CascadeClassifier::numDetections

◆ objects

CV_OUT std::vector< Rect > & cv::CascadeClassifier::objects

◆ outputRejectLevels

CV_OUT std::vector<Rect> CV_OUT std::vector<int> CV_OUT std::vector<double> double int int Size Size bool cv::CascadeClassifier::outputRejectLevels = false )

◆ rejectLevels

CV_OUT std::vector<Rect> CV_OUT std::vector<int>& cv::CascadeClassifier::rejectLevels

◆ scaleFactor [1/2]

CV_OUT std::vector<Rect> CV_OUT std::vector<int> double cv::CascadeClassifier::scaleFactor =1.1

◆ scaleFactor [2/2]

CV_OUT std::vector<Rect> CV_OUT std::vector<int> CV_OUT std::vector<double> double cv::CascadeClassifier::scaleFactor = 1.1

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