Object Detection#
Classes#
Name |
Description |
|---|---|
Cascade classifier class used for object detection. Supports HAAR and LBP cascades. : |
|
The class implements Histogram of Oriented Gradients ([71]) object detector. |
Class cv::cuda::CascadeClassifier#
Cascade classifier class used for object detection. Supports HAAR and LBP cascades. :
#include <opencv2/cudaobjdetect.hpp>Collaboration diagram for cv::cuda::CascadeClassifier:
Public Member Functions#
Public Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
Clears the algorithm state. |
|
|
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. |
|
|
Reads algorithm parameters from a file storage. |
|
|
||
|
|
|
|
Stores algorithm parameters in a file storage. |
|
|
Static Public Member Functions#
Static Public Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
|
Loads algorithm from the file. |
|
|
Loads algorithm from a String. |
|
Reads algorithm from the file node. |
Additional Inherited Members#
Protected Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
Detailed Description#
-
class CascadeClassifier : public cv::Algorithm#
Cascade classifier class used for object detection. Supports HAAR and LBP cascades. :
Note
A cascade classifier example can be found at xobjdetect_module/samples/gpu/cascadeclassifier.cpp
A Nvidea API specific cascade classifier example can be found at opencv_source_code/samples/gpu/cascadeclassifier_nvidia_api.cpp
- Examples
- samples/facedetect.cpp.
Member Function Documentation#
create()#
static Ptr< cuda::CascadeClassifier > cv::cuda::CascadeClassifier::create(const FileStorage & file)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
create()#
static Ptr< cuda::CascadeClassifier > cv::cuda::CascadeClassifier::create(const String & filename)
Loads the classifier from a file. Cascade type is detected automatically by constructor parameter.
Parameters
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/
convert()#
void cv::cuda::CascadeClassifier::convert(
OutputArray gpu_objects,
std::vector< Rect > & objects )
Converts objects array from internal representation to standard vector.
Parameters
gpu_objects— Objects array in internal representation.objects— Resulting array.
detectMultiScale()#
void cv::cuda::CascadeClassifier::detectMultiScale(
InputArray image,
OutputArray objects,
Stream & stream = Stream::Null() )
Detects objects of different sizes in the input image.
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);
See also
Parameters
image— Matrix of type CV_8U containing an image where objects should be detected.objects— Buffer to store detected objects (rectangles).stream— CUDA stream.
getClassifierSize()#
Size cv::cuda::CascadeClassifier::getClassifierSize()
getFindLargestObject()#
bool cv::cuda::CascadeClassifier::getFindLargestObject()
getMaxNumObjects()#
int cv::cuda::CascadeClassifier::getMaxNumObjects()
getMaxObjectSize()#
Size cv::cuda::CascadeClassifier::getMaxObjectSize()
getMinNeighbors()#
int cv::cuda::CascadeClassifier::getMinNeighbors()
getMinObjectSize()#
Size cv::cuda::CascadeClassifier::getMinObjectSize()
getScaleFactor()#
double cv::cuda::CascadeClassifier::getScaleFactor()
setFindLargestObject()#
void cv::cuda::CascadeClassifier::setFindLargestObject(bool findLargestObject)
setMaxNumObjects()#
void cv::cuda::CascadeClassifier::setMaxNumObjects(int maxNumObjects)
setMaxObjectSize()#
void cv::cuda::CascadeClassifier::setMaxObjectSize(Size maxObjectSize)
Maximum possible object size. Objects larger than that are ignored. Used for second signature and supported only for LBP cascades.
setMinNeighbors()#
void cv::cuda::CascadeClassifier::setMinNeighbors(int minNeighbors)
Parameter specifying how many neighbors each candidate rectangle should have to retain it.
setMinObjectSize()#
void cv::cuda::CascadeClassifier::setMinObjectSize(Size minSize)
Minimum possible object size. Objects smaller than that are ignored.
setScaleFactor()#
void cv::cuda::CascadeClassifier::setScaleFactor(double scaleFactor)
Parameter specifying how much the image size is reduced at each image scale.
Source file#
The documentation for this class was generated from the following file:
opencv2/cudaobjdetect.hpp
Class cv::cuda::HOG#
The class implements Histogram of Oriented Gradients ([71]) object detector.
#include <opencv2/cudaobjdetect.hpp>Collaboration diagram for cv::cuda::HOG:
Public Member Functions#
Public Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
Clears the algorithm state. |
|
|
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. |
|
|
Reads algorithm parameters from a file storage. |
|
|
||
|
|
|
|
Stores algorithm parameters in a file storage. |
|
|
Static Public Member Functions#
Static Public Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
|
Loads algorithm from the file. |
|
|
Loads algorithm from a String. |
|
Reads algorithm from the file node. |
Additional Inherited Members#
Protected Member Functions inherited from cv::Algorithm
Return |
Name |
Description |
|---|---|---|
|
Detailed Description#
-
class HOG : public cv::Algorithm#
The class implements Histogram of Oriented Gradients (Dalal2005) object detector.
Note
An example applying the HOG descriptor for people detection can be found at xobjdetect_module/samples/peopledetect.cpp
A CUDA example applying the HOG descriptor for people detection can be found at xobjdetect_module/samples/gpu/hog.cpp
(Python) An example applying the HOG descriptor for people detection can be found at xobjdetect_module/samples/python/peopledetect.py
- Examples
- samples/hog_tapi.cpp, and samples/peopledetect.cpp.
Member Function Documentation#
create()#
static Ptr< HOG > cv::cuda::HOG::create(
Size win_size = Size(64, 128),
Size block_size = Size(16, 16),
Size block_stride = Size(8, 8),
Size cell_size = Size(8, 8),
int nbins = 9 )
Creates the HOG descriptor and detector.
Parameters
win_size— Detection window size. Align to block size and block stride.block_size— Block size in pixels. Align to cell size. Only (16,16) is supported for now.block_stride— Block stride. It must be a multiple of cell size.cell_size— Cell size. Only (8, 8) is supported for now.nbins— Number of bins. Only 9 bins per cell are supported for now.
compute()#
void cv::cuda::HOG::compute(
InputArray img,
OutputArray descriptors,
Stream & stream = Stream::Null() )
Returns block descriptors computed for the whole image.
Parameters
img— Source image. See cuda::HOGDescriptor::detect for type limitations.descriptors— 2D array of descriptors.stream— CUDA stream.
detect()#
void cv::cuda::HOG::detect(
InputArray img,
std::vector< Point > & found_locations,
std::vector< double > & confidences )
detect()#
void cv::cuda::HOG::detect(
InputArray img,
std::vector< Point > & found_locations,
std::vector< double > * confidences = NULL )
Performs object detection without a multi-scale window.
Parameters
img— Source image. CV_8UC1 and CV_8UC4 types are supported for now.found_locations— Left-top corner points of detected objects boundaries.confidences— Optional output array for confidences.
detectMultiScale()#
void cv::cuda::HOG::detectMultiScale(
InputArray img,
std::vector< Rect > & found_locations,
std::vector< double > & confidences )
detectMultiScale()#
void cv::cuda::HOG::detectMultiScale(
InputArray img,
std::vector< Rect > & found_locations,
std::vector< double > * confidences = NULL )
Performs object detection with a multi-scale window.
Parameters
img— Source image. See cuda::HOGDescriptor::detect for type limitations.found_locations— Detected objects boundaries.confidences— Optional output array for confidences.
detectMultiScaleWithoutConf()#
void cv::cuda::HOG::detectMultiScaleWithoutConf(
InputArray img,
std::vector< Rect > & found_locations )
Performs object detection with a multi-scale window.
Parameters
img— Source image. See cuda::HOGDescriptor::detect for type limitations.found_locations— Detected objects boundaries.
detectWithoutConf()#
void cv::cuda::HOG::detectWithoutConf(
InputArray img,
std::vector< Point > & found_locations )
Performs object detection without a multi-scale window.
Parameters
img— Source image. CV_8UC1 and CV_8UC4 types are supported for now.found_locations— Left-top corner points of detected objects boundaries.
getBlockHistogramSize()#
size_t cv::cuda::HOG::getBlockHistogramSize()
Returns the block histogram size.
getDefaultPeopleDetector()#
Mat cv::cuda::HOG::getDefaultPeopleDetector()
Returns coefficients of the classifier trained for people detection.
getDescriptorFormat()#
HOGDescriptor::DescriptorStorageFormat cv::cuda::HOG::getDescriptorFormat()
getDescriptorSize()#
size_t cv::cuda::HOG::getDescriptorSize()
Returns the number of coefficients required for the classification.
getGammaCorrection()#
bool cv::cuda::HOG::getGammaCorrection()
getGroupThreshold()#
int cv::cuda::HOG::getGroupThreshold()
getHitThreshold()#
double cv::cuda::HOG::getHitThreshold()
getL2HysThreshold()#
double cv::cuda::HOG::getL2HysThreshold()
getNumLevels()#
int cv::cuda::HOG::getNumLevels()
getScaleFactor()#
double cv::cuda::HOG::getScaleFactor()
getWinSigma()#
double cv::cuda::HOG::getWinSigma()
getWinStride()#
setDescriptorFormat()#
void cv::cuda::HOG::setDescriptorFormat(HOGDescriptor::DescriptorStorageFormat descr_format)
Descriptor storage format:
DESCR_FORMAT_ROW_BY_ROW - Row-major order.
DESCR_FORMAT_COL_BY_COL - Column-major order.
setGammaCorrection()#
void cv::cuda::HOG::setGammaCorrection(bool gamma_correction)
Flag to specify whether the gamma correction preprocessing is required or not.
setGroupThreshold()#
void cv::cuda::HOG::setGroupThreshold(int group_threshold)
Coefficient to regulate the similarity threshold. When detected, some objects can be covered by many rectangles. 0 means not to perform grouping. See groupRectangles.
setHitThreshold()#
void cv::cuda::HOG::setHitThreshold(double hit_threshold)
Threshold for the distance between features and SVM classifying plane. Usually it is 0 and should be specified in the detector coefficients (as the last free coefficient). But if the free coefficient is omitted (which is allowed), you can specify it manually here.
setL2HysThreshold()#
void cv::cuda::HOG::setL2HysThreshold(double threshold_L2hys)
L2-Hys normalization method shrinkage.
setNumLevels()#
void cv::cuda::HOG::setNumLevels(int nlevels)
Maximum number of detection window increases.
setScaleFactor()#
void cv::cuda::HOG::setScaleFactor(double scale0)
Coefficient of the detection window increase.
setSVMDetector()#
void cv::cuda::HOG::setSVMDetector(InputArray detector)
Sets coefficients for the linear SVM classifier.
setWinSigma()#
void cv::cuda::HOG::setWinSigma(double win_sigma)
Gaussian smoothing window parameter.
setWinStride()#
void cv::cuda::HOG::setWinStride(Size win_stride)
Window stride. It must be a multiple of block stride.
Source file#
The documentation for this class was generated from the following file:
opencv2/cudaobjdetect.hpp