public class CascadeClassifier extends Object
Modifier and Type | Field and Description |
---|---|
protected long |
nativeObj |
Modifier | Constructor and Description |
---|---|
|
CascadeClassifier() |
protected |
CascadeClassifier(long addr) |
|
CascadeClassifier(String filename)
Loads a classifier from a file.
|
Modifier and Type | Method and Description |
---|---|
static CascadeClassifier |
__fromPtr__(long addr) |
static boolean |
convert(String oldcascade,
String newcascade) |
void |
detectMultiScale(Mat image,
MatOfRect objects)
Detects objects of different sizes in the input image.
|
void |
detectMultiScale(Mat image,
MatOfRect objects,
double scaleFactor)
Detects objects of different sizes in the input image.
|
void |
detectMultiScale(Mat image,
MatOfRect objects,
double scaleFactor,
int minNeighbors)
Detects objects of different sizes in the input image.
|
void |
detectMultiScale(Mat image,
MatOfRect objects,
double scaleFactor,
int minNeighbors,
int flags)
Detects objects of different sizes in the input image.
|
void |
detectMultiScale(Mat image,
MatOfRect objects,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize)
Detects objects of different sizes in the input image.
|
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.
|
void |
detectMultiScale2(Mat image,
MatOfRect objects,
MatOfInt numDetections) |
void |
detectMultiScale2(Mat image,
MatOfRect objects,
MatOfInt numDetections,
double scaleFactor) |
void |
detectMultiScale2(Mat image,
MatOfRect objects,
MatOfInt numDetections,
double scaleFactor,
int minNeighbors) |
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,
int flags,
Size minSize) |
void |
detectMultiScale2(Mat image,
MatOfRect objects,
MatOfInt numDetections,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize) |
void |
detectMultiScale3(Mat image,
MatOfRect objects,
MatOfInt rejectLevels,
MatOfDouble levelWeights)
This function allows you to retrieve the final stage decision certainty of classification.
|
void |
detectMultiScale3(Mat image,
MatOfRect objects,
MatOfInt rejectLevels,
MatOfDouble levelWeights,
double scaleFactor)
This function allows you to retrieve the final stage decision certainty of classification.
|
void |
detectMultiScale3(Mat image,
MatOfRect objects,
MatOfInt rejectLevels,
MatOfDouble levelWeights,
double scaleFactor,
int minNeighbors)
This function allows you to retrieve the final stage decision certainty of classification.
|
void |
detectMultiScale3(Mat image,
MatOfRect objects,
MatOfInt rejectLevels,
MatOfDouble levelWeights,
double scaleFactor,
int minNeighbors,
int flags)
This function allows you to retrieve the final stage decision certainty of classification.
|
void |
detectMultiScale3(Mat image,
MatOfRect objects,
MatOfInt rejectLevels,
MatOfDouble levelWeights,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize)
This function allows you to retrieve the final stage decision certainty of classification.
|
void |
detectMultiScale3(Mat image,
MatOfRect objects,
MatOfInt rejectLevels,
MatOfDouble levelWeights,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize)
This function allows you to retrieve the final stage decision certainty of classification.
|
void |
detectMultiScale3(Mat image,
MatOfRect objects,
MatOfInt rejectLevels,
MatOfDouble levelWeights,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize,
boolean outputRejectLevels)
This function allows you to retrieve the final stage decision certainty of classification.
|
boolean |
empty()
Checks whether the classifier has been loaded.
|
protected void |
finalize() |
int |
getFeatureType() |
long |
getNativeObjAddr() |
Size |
getOriginalWindowSize() |
boolean |
isOldFormatCascade() |
boolean |
load(String filename)
Loads a classifier from a file.
|
protected CascadeClassifier(long addr)
public CascadeClassifier(String filename)
filename
- Name of the file from which the classifier is loaded.public CascadeClassifier()
public long getNativeObjAddr()
public static CascadeClassifier __fromPtr__(long addr)
public Size getOriginalWindowSize()
public boolean empty()
public boolean isOldFormatCascade()
public boolean load(String filename)
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.public int getFeatureType()
public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
image
- Matrix of the type CV_8U containing an image where objects are detected.objects
- Vector of rectangles where each rectangle contains the detected object, the
rectangles may be partially outside the original image.scaleFactor
- Parameter specifying how much the image size is reduced at each image scale.minNeighbors
- Parameter specifying how many neighbors each candidate rectangle should have
to retain it.flags
- Parameter with the same meaning for an old cascade as in the function
cvHaarDetectObjects. It is not used for a new cascade.minSize
- Minimum possible object size. Objects smaller than that are ignored.maxSize
- Maximum possible object size. Objects larger than that are ignored. If maxSize == minSize
model is evaluated on single scale.
The function is parallelized with the TBB library.
Note:
public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags, Size minSize)
image
- Matrix of the type CV_8U containing an image where objects are detected.objects
- Vector of rectangles where each rectangle contains the detected object, the
rectangles may be partially outside the original image.scaleFactor
- Parameter specifying how much the image size is reduced at each image scale.minNeighbors
- Parameter specifying how many neighbors each candidate rectangle should have
to retain it.flags
- Parameter with the same meaning for an old cascade as in the function
cvHaarDetectObjects. It is not used for a new cascade.minSize
- Minimum possible object size. Objects smaller than that are ignored.
The function is parallelized with the TBB library.
Note:
public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags)
image
- Matrix of the type CV_8U containing an image where objects are detected.objects
- Vector of rectangles where each rectangle contains the detected object, the
rectangles may be partially outside the original image.scaleFactor
- Parameter specifying how much the image size is reduced at each image scale.minNeighbors
- Parameter specifying how many neighbors each candidate rectangle should have
to retain it.flags
- Parameter with the same meaning for an old cascade as in the function
cvHaarDetectObjects. It is not used for a new cascade.
The function is parallelized with the TBB library.
Note:
public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor, int minNeighbors)
image
- Matrix of the type CV_8U containing an image where objects are detected.objects
- Vector of rectangles where each rectangle contains the detected object, the
rectangles may be partially outside the original image.scaleFactor
- Parameter specifying how much the image size is reduced at each image scale.minNeighbors
- Parameter specifying how many neighbors each candidate rectangle should have
to retain it.
cvHaarDetectObjects. It is not used for a new cascade.
The function is parallelized with the TBB library.
Note:
public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor)
image
- Matrix of the type CV_8U containing an image where objects are detected.objects
- Vector of rectangles where each rectangle contains the detected object, the
rectangles may be partially outside the original image.scaleFactor
- Parameter specifying how much the image size is reduced at each image scale.
to retain it.
cvHaarDetectObjects. It is not used for a new cascade.
The function is parallelized with the TBB library.
Note:
public void detectMultiScale(Mat image, MatOfRect objects)
image
- Matrix of the type CV_8U containing an image where objects are detected.objects
- Vector of rectangles where each rectangle contains the detected object, the
rectangles may be partially outside the original image.
to retain it.
cvHaarDetectObjects. It is not used for a new cascade.
The function is parallelized with the TBB library.
Note:
public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
image
- Matrix of the type CV_8U containing an image where objects are detected.objects
- Vector of rectangles where each rectangle contains the detected object, the
rectangles may be partially outside the original image.numDetections
- Vector 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.scaleFactor
- Parameter specifying how much the image size is reduced at each image scale.minNeighbors
- Parameter specifying how many neighbors each candidate rectangle should have
to retain it.flags
- Parameter with the same meaning for an old cascade as in the function
cvHaarDetectObjects. It is not used for a new cascade.minSize
- Minimum possible object size. Objects smaller than that are ignored.maxSize
- Maximum possible object size. Objects larger than that are ignored. If maxSize == minSize
model is evaluated on single scale.public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize)
image
- Matrix of the type CV_8U containing an image where objects are detected.objects
- Vector of rectangles where each rectangle contains the detected object, the
rectangles may be partially outside the original image.numDetections
- Vector 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.scaleFactor
- Parameter specifying how much the image size is reduced at each image scale.minNeighbors
- Parameter specifying how many neighbors each candidate rectangle should have
to retain it.flags
- Parameter with the same meaning for an old cascade as in the function
cvHaarDetectObjects. It is not used for a new cascade.minSize
- Minimum possible object size. Objects smaller than that are ignored.public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags)
image
- Matrix of the type CV_8U containing an image where objects are detected.objects
- Vector of rectangles where each rectangle contains the detected object, the
rectangles may be partially outside the original image.numDetections
- Vector 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.scaleFactor
- Parameter specifying how much the image size is reduced at each image scale.minNeighbors
- Parameter specifying how many neighbors each candidate rectangle should have
to retain it.flags
- Parameter with the same meaning for an old cascade as in the function
cvHaarDetectObjects. It is not used for a new cascade.public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors)
image
- Matrix of the type CV_8U containing an image where objects are detected.objects
- Vector of rectangles where each rectangle contains the detected object, the
rectangles may be partially outside the original image.numDetections
- Vector 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.scaleFactor
- Parameter specifying how much the image size is reduced at each image scale.minNeighbors
- Parameter specifying how many neighbors each candidate rectangle should have
to retain it.
cvHaarDetectObjects. It is not used for a new cascade.public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor)
image
- Matrix of the type CV_8U containing an image where objects are detected.objects
- Vector of rectangles where each rectangle contains the detected object, the
rectangles may be partially outside the original image.numDetections
- Vector 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.scaleFactor
- Parameter specifying how much the image size is reduced at each image scale.
to retain it.
cvHaarDetectObjects. It is not used for a new cascade.public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections)
image
- Matrix of the type CV_8U containing an image where objects are detected.objects
- Vector of rectangles where each rectangle contains the detected object, the
rectangles may be partially outside the original image.numDetections
- Vector 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.
to retain it.
cvHaarDetectObjects. It is not used for a new cascade.public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize, boolean outputRejectLevels)
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;
image
- automatically generatedobjects
- automatically generatedrejectLevels
- automatically generatedlevelWeights
- automatically generatedscaleFactor
- automatically generatedminNeighbors
- automatically generatedflags
- automatically generatedminSize
- automatically generatedmaxSize
- automatically generatedoutputRejectLevels
- automatically generatedpublic void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize)
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;
image
- automatically generatedobjects
- automatically generatedrejectLevels
- automatically generatedlevelWeights
- automatically generatedscaleFactor
- automatically generatedminNeighbors
- automatically generatedflags
- automatically generatedminSize
- automatically generatedmaxSize
- automatically generatedpublic void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize)
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;
image
- automatically generatedobjects
- automatically generatedrejectLevels
- automatically generatedlevelWeights
- automatically generatedscaleFactor
- automatically generatedminNeighbors
- automatically generatedflags
- automatically generatedminSize
- automatically generatedpublic void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags)
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;
image
- automatically generatedobjects
- automatically generatedrejectLevels
- automatically generatedlevelWeights
- automatically generatedscaleFactor
- automatically generatedminNeighbors
- automatically generatedflags
- automatically generatedpublic void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors)
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;
image
- automatically generatedobjects
- automatically generatedrejectLevels
- automatically generatedlevelWeights
- automatically generatedscaleFactor
- automatically generatedminNeighbors
- automatically generatedpublic void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor)
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;
image
- automatically generatedobjects
- automatically generatedrejectLevels
- automatically generatedlevelWeights
- automatically generatedscaleFactor
- automatically generatedpublic void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights)
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;
image
- automatically generatedobjects
- automatically generatedrejectLevels
- automatically generatedlevelWeights
- automatically generatedCopyright © 2020. All rights reserved.