@Name(value="cv::cuda::CascadeClassifier") @Properties(inherit=opencv_cudaobjdetect.class) public class CudaCascadeClassifier extends Algorithm
\note - A cascade classifier example can be found at opencv_source_code/samples/gpu/cascadeclassifier.cpp - A Nvidea API specific cascade classifier example can be found at opencv_source_code/samples/gpu/cascadeclassifier_nvidia_api.cpp
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
CudaCascadeClassifier(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
convert(GpuMat gpu_objects,
RectVector objects) |
void |
convert(Mat gpu_objects,
RectVector objects)
\brief Converts objects array from internal representation to standard vector.
|
void |
convert(UMat gpu_objects,
RectVector objects) |
static CudaCascadeClassifier |
create(BytePointer filename)
\brief Loads the classifier from a file.
|
static CudaCascadeClassifier |
create(FileStorage file)
\overload
|
static CudaCascadeClassifier |
create(String filename) |
void |
detectMultiScale(GpuMat image,
GpuMat objects) |
void |
detectMultiScale(GpuMat image,
GpuMat objects,
Stream stream) |
void |
detectMultiScale(Mat image,
Mat objects) |
void |
detectMultiScale(Mat image,
Mat objects,
Stream stream)
\brief Detects objects of different sizes in the input image.
|
void |
detectMultiScale(UMat image,
UMat objects) |
void |
detectMultiScale(UMat image,
UMat objects,
Stream stream) |
Size |
getClassifierSize() |
boolean |
getFindLargestObject() |
int |
getMaxNumObjects() |
Size |
getMaxObjectSize() |
int |
getMinNeighbors() |
Size |
getMinObjectSize() |
double |
getScaleFactor() |
void |
setFindLargestObject(boolean findLargestObject) |
void |
setMaxNumObjects(int maxNumObjects) |
void |
setMaxObjectSize(Size maxObjectSize)
Maximum possible object size.
|
void |
setMinNeighbors(int minNeighbors)
Parameter specifying how many neighbors each candidate rectangle should have
to retain it.
|
void |
setMinObjectSize(Size minSize)
Minimum possible object size.
|
void |
setScaleFactor(double scaleFactor)
Parameter specifying how much the image size is reduced at each image scale.
|
clear, empty, getDefaultName, position, read, save, save, write, write, write
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zero
public CudaCascadeClassifier(Pointer p)
Pointer.Pointer(Pointer)
.@opencv_core.Ptr public static CudaCascadeClassifier create(@opencv_core.Str BytePointer filename)
filename
- Name of the file from which the classifier is loaded. Only the old haar classifier
(trained by the haar training application) and NVIDIA's nvbin are supported for HAAR and only new
type of OpenCV XML cascade supported for LBP. The working haar models can be found at opencv_folder/data/haarcascades_cuda/@opencv_core.Ptr public static CudaCascadeClassifier create(@opencv_core.Str String filename)
@opencv_core.Ptr public static CudaCascadeClassifier create(@Const @ByRef FileStorage file)
public void setMaxObjectSize(@ByVal Size maxObjectSize)
public void setMinObjectSize(@ByVal Size minSize)
public void setScaleFactor(double scaleFactor)
public double getScaleFactor()
public void setMinNeighbors(int minNeighbors)
public int getMinNeighbors()
public void setFindLargestObject(@Cast(value="bool") boolean findLargestObject)
public void setMaxNumObjects(int maxNumObjects)
public int getMaxNumObjects()
public void detectMultiScale(@ByVal Mat image, @ByVal Mat objects, @ByRef(nullValue="cv::cuda::Stream::Null()") Stream stream)
image
- Matrix of type CV_8U containing an image where objects should be detected.objects
- Buffer to store detected objects (rectangles).stream
- CUDA stream.
To get final array of detected objects use CascadeClassifier::convert method.
Ptr<cuda::CascadeClassifier> cascade_gpu = cuda::CascadeClassifier::create(...);
Mat image_cpu = imread(...)
GpuMat image_gpu(image_cpu);
GpuMat objbuf;
cascade_gpu->detectMultiScale(image_gpu, objbuf);
std::vector<Rect> faces;
cascade_gpu->convert(objbuf, faces);
for(int i = 0; i < detections_num; ++i)
cv::rectangle(image_cpu, faces[i], Scalar(255));
imshow("Faces", image_cpu);
CascadeClassifier::detectMultiScale
public void detectMultiScale(@ByVal UMat image, @ByVal UMat objects, @ByRef(nullValue="cv::cuda::Stream::Null()") Stream stream)
public void detectMultiScale(@ByVal GpuMat image, @ByVal GpuMat objects, @ByRef(nullValue="cv::cuda::Stream::Null()") Stream stream)
public void convert(@ByVal Mat gpu_objects, @ByRef RectVector objects)
gpu_objects
- Objects array in internal representation.objects
- Resulting array.public void convert(@ByVal UMat gpu_objects, @ByRef RectVector objects)
public void convert(@ByVal GpuMat gpu_objects, @ByRef RectVector objects)
Copyright © 2020. All rights reserved.