@Namespace(value="cv") @NoOffset @Properties(inherit=opencv_objdetect.class) public class CascadeClassifier extends Pointer
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
CascadeClassifier() |
CascadeClassifier(BytePointer filename)
\brief Loads a classifier from a file.
|
CascadeClassifier(long size)
Native array allocator.
|
CascadeClassifier(Pointer p)
Pointer cast constructor.
|
CascadeClassifier(String filename) |
Modifier and Type | Method and Description |
---|---|
BaseCascadeClassifier |
cc() |
CascadeClassifier |
cc(BaseCascadeClassifier setter) |
static boolean |
convert(BytePointer oldcascade,
BytePointer newcascade) |
static boolean |
convert(String oldcascade,
String newcascade) |
void |
detectMultiScale(GpuMat image,
RectVector objects) |
void |
detectMultiScale(GpuMat image,
RectVector objects,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize) |
void |
detectMultiScale(Mat image,
RectVector objects) |
void |
detectMultiScale(Mat image,
RectVector objects,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize)
\brief Detects objects of different sizes in the input image.
|
void |
detectMultiScale(UMat image,
RectVector objects) |
void |
detectMultiScale(UMat image,
RectVector objects,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize) |
void |
detectMultiScale2(GpuMat image,
RectVector objects,
int[] numDetections) |
void |
detectMultiScale2(GpuMat image,
RectVector objects,
int[] numDetections,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize) |
void |
detectMultiScale2(GpuMat image,
RectVector objects,
IntBuffer numDetections) |
void |
detectMultiScale2(GpuMat image,
RectVector objects,
IntBuffer numDetections,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize) |
void |
detectMultiScale2(GpuMat image,
RectVector objects,
IntPointer numDetections) |
void |
detectMultiScale2(GpuMat image,
RectVector objects,
IntPointer numDetections,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize) |
void |
detectMultiScale2(Mat image,
RectVector objects,
int[] numDetections) |
void |
detectMultiScale2(Mat image,
RectVector objects,
int[] numDetections,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize) |
void |
detectMultiScale2(Mat image,
RectVector objects,
IntBuffer numDetections) |
void |
detectMultiScale2(Mat image,
RectVector objects,
IntBuffer numDetections,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize) |
void |
detectMultiScale2(Mat image,
RectVector objects,
IntPointer numDetections) |
void |
detectMultiScale2(Mat image,
RectVector objects,
IntPointer numDetections,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize)
\overload
|
void |
detectMultiScale2(UMat image,
RectVector objects,
int[] numDetections) |
void |
detectMultiScale2(UMat image,
RectVector objects,
int[] numDetections,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize) |
void |
detectMultiScale2(UMat image,
RectVector objects,
IntBuffer numDetections) |
void |
detectMultiScale2(UMat image,
RectVector objects,
IntBuffer numDetections,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize) |
void |
detectMultiScale2(UMat image,
RectVector objects,
IntPointer numDetections) |
void |
detectMultiScale2(UMat image,
RectVector objects,
IntPointer numDetections,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize) |
void |
detectMultiScale3(GpuMat image,
RectVector objects,
int[] rejectLevels,
double[] levelWeights) |
void |
detectMultiScale3(GpuMat image,
RectVector objects,
int[] rejectLevels,
double[] levelWeights,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize,
boolean outputRejectLevels) |
void |
detectMultiScale3(GpuMat image,
RectVector objects,
IntBuffer rejectLevels,
DoubleBuffer levelWeights) |
void |
detectMultiScale3(GpuMat image,
RectVector objects,
IntBuffer rejectLevels,
DoubleBuffer levelWeights,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize,
boolean outputRejectLevels) |
void |
detectMultiScale3(GpuMat image,
RectVector objects,
IntPointer rejectLevels,
DoublePointer levelWeights) |
void |
detectMultiScale3(GpuMat image,
RectVector objects,
IntPointer rejectLevels,
DoublePointer levelWeights,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize,
boolean outputRejectLevels) |
void |
detectMultiScale3(Mat image,
RectVector objects,
int[] rejectLevels,
double[] levelWeights) |
void |
detectMultiScale3(Mat image,
RectVector objects,
int[] rejectLevels,
double[] levelWeights,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize,
boolean outputRejectLevels) |
void |
detectMultiScale3(Mat image,
RectVector objects,
IntBuffer rejectLevels,
DoubleBuffer levelWeights) |
void |
detectMultiScale3(Mat image,
RectVector objects,
IntBuffer rejectLevels,
DoubleBuffer levelWeights,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize,
boolean outputRejectLevels) |
void |
detectMultiScale3(Mat image,
RectVector objects,
IntPointer rejectLevels,
DoublePointer levelWeights) |
void |
detectMultiScale3(Mat image,
RectVector objects,
IntPointer rejectLevels,
DoublePointer levelWeights,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize,
boolean outputRejectLevels)
\overload
This function allows you to retrieve the final stage decision certainty of classification.
|
void |
detectMultiScale3(UMat image,
RectVector objects,
int[] rejectLevels,
double[] levelWeights) |
void |
detectMultiScale3(UMat image,
RectVector objects,
int[] rejectLevels,
double[] levelWeights,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize,
boolean outputRejectLevels) |
void |
detectMultiScale3(UMat image,
RectVector objects,
IntBuffer rejectLevels,
DoubleBuffer levelWeights) |
void |
detectMultiScale3(UMat image,
RectVector objects,
IntBuffer rejectLevels,
DoubleBuffer levelWeights,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize,
boolean outputRejectLevels) |
void |
detectMultiScale3(UMat image,
RectVector objects,
IntPointer rejectLevels,
DoublePointer levelWeights) |
void |
detectMultiScale3(UMat image,
RectVector objects,
IntPointer rejectLevels,
DoublePointer levelWeights,
double scaleFactor,
int minNeighbors,
int flags,
Size minSize,
Size maxSize,
boolean outputRejectLevels) |
boolean |
empty()
\brief Checks whether the classifier has been loaded.
|
int |
getFeatureType() |
BaseCascadeClassifier.MaskGenerator |
getMaskGenerator() |
Pointer |
getOldCascade() |
Size |
getOriginalWindowSize() |
CascadeClassifier |
getPointer(long i) |
boolean |
isOldFormatCascade() |
boolean |
load(BytePointer filename)
\brief Loads a classifier from a file.
|
boolean |
load(String filename) |
CascadeClassifier |
position(long position) |
boolean |
read(FileNode node)
\brief Reads a classifier from a FileStorage node.
|
void |
setMaskGenerator(BaseCascadeClassifier.MaskGenerator maskGenerator) |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
public CascadeClassifier(Pointer p)
Pointer(Pointer)
.public CascadeClassifier(long size)
Pointer.position(long)
.public CascadeClassifier()
public CascadeClassifier(@opencv_core.Str BytePointer filename)
filename
- Name of the file from which the classifier is loaded.public CascadeClassifier(@opencv_core.Str String filename)
public CascadeClassifier position(long position)
public CascadeClassifier getPointer(long i)
getPointer
in class Pointer
@Cast(value="bool") public boolean empty()
@Cast(value="bool") public boolean load(@opencv_core.Str BytePointer 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.@Cast(value="bool") public boolean load(@opencv_core.Str String filename)
@Cast(value="bool") public boolean read(@Const @ByRef FileNode node)
\note The file may contain a new cascade classifier (trained by the traincascade application) only.
public void detectMultiScale(@ByVal Mat image, @ByRef RectVector objects, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") 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.public void detectMultiScale(@ByVal Mat image, @ByRef RectVector objects)
public void detectMultiScale(@ByVal UMat image, @ByRef RectVector objects, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize)
public void detectMultiScale(@ByVal UMat image, @ByRef RectVector objects)
public void detectMultiScale(@ByVal GpuMat image, @ByRef RectVector objects, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize)
public void detectMultiScale(@ByVal GpuMat image, @ByRef RectVector objects)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal Mat image, @ByRef RectVector objects, @StdVector IntPointer numDetections, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") 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.@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal Mat image, @ByRef RectVector objects, @StdVector IntPointer numDetections)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal Mat image, @ByRef RectVector objects, @StdVector IntBuffer numDetections, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal Mat image, @ByRef RectVector objects, @StdVector IntBuffer numDetections)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal Mat image, @ByRef RectVector objects, @StdVector int[] numDetections, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal Mat image, @ByRef RectVector objects, @StdVector int[] numDetections)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal UMat image, @ByRef RectVector objects, @StdVector IntPointer numDetections, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal UMat image, @ByRef RectVector objects, @StdVector IntPointer numDetections)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal UMat image, @ByRef RectVector objects, @StdVector IntBuffer numDetections, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal UMat image, @ByRef RectVector objects, @StdVector IntBuffer numDetections)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal UMat image, @ByRef RectVector objects, @StdVector int[] numDetections, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal UMat image, @ByRef RectVector objects, @StdVector int[] numDetections)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal GpuMat image, @ByRef RectVector objects, @StdVector IntPointer numDetections, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal GpuMat image, @ByRef RectVector objects, @StdVector IntPointer numDetections)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal GpuMat image, @ByRef RectVector objects, @StdVector IntBuffer numDetections, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal GpuMat image, @ByRef RectVector objects, @StdVector IntBuffer numDetections)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal GpuMat image, @ByRef RectVector objects, @StdVector int[] numDetections, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize)
@Name(value="detectMultiScale") public void detectMultiScale2(@ByVal GpuMat image, @ByRef RectVector objects, @StdVector int[] numDetections)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal Mat image, @ByRef RectVector objects, @StdVector IntPointer rejectLevels, @StdVector DoublePointer levelWeights, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize, @Cast(value="bool") 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;
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal Mat image, @ByRef RectVector objects, @StdVector IntPointer rejectLevels, @StdVector DoublePointer levelWeights)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal Mat image, @ByRef RectVector objects, @StdVector IntBuffer rejectLevels, @StdVector DoubleBuffer levelWeights, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize, @Cast(value="bool") boolean outputRejectLevels)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal Mat image, @ByRef RectVector objects, @StdVector IntBuffer rejectLevels, @StdVector DoubleBuffer levelWeights)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal Mat image, @ByRef RectVector objects, @StdVector int[] rejectLevels, @StdVector double[] levelWeights, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize, @Cast(value="bool") boolean outputRejectLevels)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal Mat image, @ByRef RectVector objects, @StdVector int[] rejectLevels, @StdVector double[] levelWeights)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal UMat image, @ByRef RectVector objects, @StdVector IntPointer rejectLevels, @StdVector DoublePointer levelWeights, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize, @Cast(value="bool") boolean outputRejectLevels)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal UMat image, @ByRef RectVector objects, @StdVector IntPointer rejectLevels, @StdVector DoublePointer levelWeights)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal UMat image, @ByRef RectVector objects, @StdVector IntBuffer rejectLevels, @StdVector DoubleBuffer levelWeights, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize, @Cast(value="bool") boolean outputRejectLevels)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal UMat image, @ByRef RectVector objects, @StdVector IntBuffer rejectLevels, @StdVector DoubleBuffer levelWeights)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal UMat image, @ByRef RectVector objects, @StdVector int[] rejectLevels, @StdVector double[] levelWeights, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize, @Cast(value="bool") boolean outputRejectLevels)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal UMat image, @ByRef RectVector objects, @StdVector int[] rejectLevels, @StdVector double[] levelWeights)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal GpuMat image, @ByRef RectVector objects, @StdVector IntPointer rejectLevels, @StdVector DoublePointer levelWeights, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize, @Cast(value="bool") boolean outputRejectLevels)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal GpuMat image, @ByRef RectVector objects, @StdVector IntPointer rejectLevels, @StdVector DoublePointer levelWeights)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal GpuMat image, @ByRef RectVector objects, @StdVector IntBuffer rejectLevels, @StdVector DoubleBuffer levelWeights, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize, @Cast(value="bool") boolean outputRejectLevels)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal GpuMat image, @ByRef RectVector objects, @StdVector IntBuffer rejectLevels, @StdVector DoubleBuffer levelWeights)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal GpuMat image, @ByRef RectVector objects, @StdVector int[] rejectLevels, @StdVector double[] levelWeights, double scaleFactor, int minNeighbors, int flags, @ByVal(nullValue="cv::Size()") Size minSize, @ByVal(nullValue="cv::Size()") Size maxSize, @Cast(value="bool") boolean outputRejectLevels)
@Name(value="detectMultiScale") public void detectMultiScale3(@ByVal GpuMat image, @ByRef RectVector objects, @StdVector int[] rejectLevels, @StdVector double[] levelWeights)
public int getFeatureType()
public Pointer getOldCascade()
@Cast(value="bool") public static boolean convert(@opencv_core.Str BytePointer oldcascade, @opencv_core.Str BytePointer newcascade)
@Cast(value="bool") public static boolean convert(@opencv_core.Str String oldcascade, @opencv_core.Str String newcascade)
public void setMaskGenerator(@opencv_core.Ptr BaseCascadeClassifier.MaskGenerator maskGenerator)
@opencv_core.Ptr public BaseCascadeClassifier.MaskGenerator getMaskGenerator()
@opencv_core.Ptr public BaseCascadeClassifier cc()
public CascadeClassifier cc(BaseCascadeClassifier setter)
Copyright © 2024. All rights reserved.