org.opencv.objdetect
public class CascadeClassifier extends java.lang.Object
Cascade classifier class for object detection.
Constructor and Description |
---|
CascadeClassifier()
Loads a classifier from a file.
|
CascadeClassifier(java.lang.String filename)
Loads a classifier from a file.
|
Modifier and Type | Method and Description |
---|---|
void |
detectMultiScale(Mat image,
MatOfRect objects)
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 |
detectMultiScale(Mat image,
MatOfRect objects,
MatOfInt rejectLevels,
MatOfDouble levelWeights)
Detects objects of different sizes in the input image.
|
void |
detectMultiScale(Mat image,
MatOfRect objects,
MatOfInt rejectLevels,
MatOfDouble levelWeights,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize,
boolean outputRejectLevels)
Detects objects of different sizes in the input image.
|
boolean |
empty()
Checks whether the classifier has been loaded.
|
boolean |
load(java.lang.String filename)
Loads a classifier from a file.
|
public CascadeClassifier()
Loads a classifier from a file.
public CascadeClassifier(java.lang.String filename)
Loads a classifier from a file.
filename
- Name of the file from which the classifier is loaded.public 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.
The function is parallelized with the TBB library.
Note:
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.public 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.
The function is parallelized with the TBB library.
Note:
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.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.public void detectMultiScale(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights)
Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.
The function is parallelized with the TBB library.
Note:
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.rejectLevels
- a rejectLevelslevelWeights
- a levelWeightspublic void detectMultiScale(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize, boolean outputRejectLevels)
Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.
The function is parallelized with the TBB library.
Note:
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.rejectLevels
- a rejectLevelslevelWeights
- a levelWeightsscaleFactor
- 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.outputRejectLevels
- a outputRejectLevelspublic boolean empty()
Checks whether the classifier has been loaded.
public boolean load(java.lang.String filename)
Loads a classifier from a file.
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.