OpenCV  4.8.0
Open Source Computer Vision
Public Member Functions | Static Public Member Functions | List of all members
cv::cuda::HOG Class Referenceabstract

The class implements Histogram of Oriented Gradients ([54]) object detector. More...

#include <opencv2/cudaobjdetect.hpp>

Inheritance diagram for cv::cuda::HOG:
cv::Algorithm

Public Member Functions

virtual void compute (InputArray img, OutputArray descriptors, Stream &stream=Stream::Null())=0
 Returns block descriptors computed for the whole image. More...
 
virtual void detect (InputArray img, std::vector< Point > &found_locations, std::vector< double > *confidences=NULL)=0
 Performs object detection without a multi-scale window. More...
 
void detect (InputArray img, std::vector< Point > &found_locations, std::vector< double > &confidences)
 
virtual void detectMultiScale (InputArray img, std::vector< Rect > &found_locations, std::vector< double > *confidences=NULL)=0
 Performs object detection with a multi-scale window. More...
 
void detectMultiScale (InputArray img, std::vector< Rect > &found_locations, std::vector< double > &confidences)
 
void detectMultiScaleWithoutConf (InputArray img, std::vector< Rect > &found_locations)
 Performs object detection with a multi-scale window. More...
 
void detectWithoutConf (InputArray img, std::vector< Point > &found_locations)
 Performs object detection without a multi-scale window. More...
 
virtual size_t getBlockHistogramSize () const =0
 Returns the block histogram size. More...
 
virtual Mat getDefaultPeopleDetector () const =0
 Returns coefficients of the classifier trained for people detection. More...
 
virtual HOGDescriptor::DescriptorStorageFormat getDescriptorFormat () const =0
 
virtual size_t getDescriptorSize () const =0
 Returns the number of coefficients required for the classification. More...
 
virtual bool getGammaCorrection () const =0
 
virtual int getGroupThreshold () const =0
 
virtual double getHitThreshold () const =0
 
virtual double getL2HysThreshold () const =0
 
virtual int getNumLevels () const =0
 
virtual double getScaleFactor () const =0
 
virtual double getWinSigma () const =0
 
virtual Size getWinStride () const =0
 
virtual void setDescriptorFormat (HOGDescriptor::DescriptorStorageFormat descr_format)=0
 
virtual void setGammaCorrection (bool gamma_correction)=0
 Flag to specify whether the gamma correction preprocessing is required or not. More...
 
virtual void setGroupThreshold (int group_threshold)=0
 
virtual void setHitThreshold (double hit_threshold)=0
 
virtual void setL2HysThreshold (double threshold_L2hys)=0
 L2-Hys normalization method shrinkage. More...
 
virtual void setNumLevels (int nlevels)=0
 Maximum number of detection window increases. More...
 
virtual void setScaleFactor (double scale0)=0
 Coefficient of the detection window increase. More...
 
virtual void setSVMDetector (InputArray detector)=0
 Sets coefficients for the linear SVM classifier. More...
 
virtual void setWinSigma (double win_sigma)=0
 Gaussian smoothing window parameter. More...
 
virtual void setWinStride (Size win_stride)=0
 Window stride. It must be a multiple of block stride. More...
 
- Public Member Functions inherited from cv::Algorithm
 Algorithm ()
 
virtual ~Algorithm ()
 
virtual void clear ()
 Clears the algorithm state. More...
 
virtual bool empty () const
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. More...
 
virtual String getDefaultName () const
 
virtual void read (const FileNode &fn)
 Reads algorithm parameters from a file storage. More...
 
virtual void save (const String &filename) const
 
virtual void write (FileStorage &fs) const
 Stores algorithm parameters in a file storage. More...
 
void write (FileStorage &fs, const String &name) const
 
void write (const Ptr< FileStorage > &fs, const String &name=String()) const
 

Static Public Member Functions

static Ptr< HOGcreate (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. More...
 
- Static Public Member Functions inherited from cv::Algorithm
template<typename _Tp >
static Ptr< _Tp > load (const String &filename, const String &objname=String())
 Loads algorithm from the file. More...
 
template<typename _Tp >
static Ptr< _Tp > loadFromString (const String &strModel, const String &objname=String())
 Loads algorithm from a String. More...
 
template<typename _Tp >
static Ptr< _Tp > read (const FileNode &fn)
 Reads algorithm from the file node. More...
 

Additional Inherited Members

- Protected Member Functions inherited from cv::Algorithm
void writeFormat (FileStorage &fs) const
 

Detailed Description

The class implements Histogram of Oriented Gradients ([54]) object detector.

Note
  • An example applying the HOG descriptor for people detection can be found at opencv_source_code/samples/cpp/peopledetect.cpp
  • A CUDA example applying the HOG descriptor for people detection can be found at opencv_source_code/samples/gpu/hog.cpp
  • (Python) An example applying the HOG descriptor for people detection can be found at opencv_source_code/samples/python/peopledetect.py

Member Function Documentation

◆ compute()

virtual void cv::cuda::HOG::compute ( InputArray  img,
OutputArray  descriptors,
Stream stream = Stream::Null() 
)
pure virtual

Returns block descriptors computed for the whole image.

Parameters
imgSource image. See cuda::HOGDescriptor::detect for type limitations.
descriptors2D array of descriptors.
streamCUDA stream.

◆ 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 
)
static

Creates the HOG descriptor and detector.

Parameters
win_sizeDetection window size. Align to block size and block stride.
block_sizeBlock size in pixels. Align to cell size. Only (16,16) is supported for now.
block_strideBlock stride. It must be a multiple of cell size.
cell_sizeCell size. Only (8, 8) is supported for now.
nbinsNumber of bins. Only 9 bins per cell are supported for now.

◆ detect() [1/2]

virtual void cv::cuda::HOG::detect ( InputArray  img,
std::vector< Point > &  found_locations,
std::vector< double > *  confidences = NULL 
)
pure virtual

Performs object detection without a multi-scale window.

Parameters
imgSource image. CV_8UC1 and CV_8UC4 types are supported for now.
found_locationsLeft-top corner points of detected objects boundaries.
confidencesOptional output array for confidences.

◆ detect() [2/2]

void cv::cuda::HOG::detect ( InputArray  img,
std::vector< Point > &  found_locations,
std::vector< double > &  confidences 
)
inline

◆ detectMultiScale() [1/2]

virtual void cv::cuda::HOG::detectMultiScale ( InputArray  img,
std::vector< Rect > &  found_locations,
std::vector< double > *  confidences = NULL 
)
pure virtual

Performs object detection with a multi-scale window.

Parameters
imgSource image. See cuda::HOGDescriptor::detect for type limitations.
found_locationsDetected objects boundaries.
confidencesOptional output array for confidences.

◆ detectMultiScale() [2/2]

void cv::cuda::HOG::detectMultiScale ( InputArray  img,
std::vector< Rect > &  found_locations,
std::vector< double > &  confidences 
)
inline

◆ detectMultiScaleWithoutConf()

void cv::cuda::HOG::detectMultiScaleWithoutConf ( InputArray  img,
std::vector< Rect > &  found_locations 
)
inline

Performs object detection with a multi-scale window.

Parameters
imgSource image. See cuda::HOGDescriptor::detect for type limitations.
found_locationsDetected objects boundaries.

◆ detectWithoutConf()

void cv::cuda::HOG::detectWithoutConf ( InputArray  img,
std::vector< Point > &  found_locations 
)
inline

Performs object detection without a multi-scale window.

Parameters
imgSource image. CV_8UC1 and CV_8UC4 types are supported for now.
found_locationsLeft-top corner points of detected objects boundaries.

◆ getBlockHistogramSize()

virtual size_t cv::cuda::HOG::getBlockHistogramSize ( ) const
pure virtual

Returns the block histogram size.

◆ getDefaultPeopleDetector()

virtual Mat cv::cuda::HOG::getDefaultPeopleDetector ( ) const
pure virtual

Returns coefficients of the classifier trained for people detection.

◆ getDescriptorFormat()

virtual HOGDescriptor::DescriptorStorageFormat cv::cuda::HOG::getDescriptorFormat ( ) const
pure virtual

◆ getDescriptorSize()

virtual size_t cv::cuda::HOG::getDescriptorSize ( ) const
pure virtual

Returns the number of coefficients required for the classification.

◆ getGammaCorrection()

virtual bool cv::cuda::HOG::getGammaCorrection ( ) const
pure virtual

◆ getGroupThreshold()

virtual int cv::cuda::HOG::getGroupThreshold ( ) const
pure virtual

◆ getHitThreshold()

virtual double cv::cuda::HOG::getHitThreshold ( ) const
pure virtual

◆ getL2HysThreshold()

virtual double cv::cuda::HOG::getL2HysThreshold ( ) const
pure virtual

◆ getNumLevels()

virtual int cv::cuda::HOG::getNumLevels ( ) const
pure virtual

◆ getScaleFactor()

virtual double cv::cuda::HOG::getScaleFactor ( ) const
pure virtual

◆ getWinSigma()

virtual double cv::cuda::HOG::getWinSigma ( ) const
pure virtual

◆ getWinStride()

virtual Size cv::cuda::HOG::getWinStride ( ) const
pure virtual

◆ setDescriptorFormat()

virtual void cv::cuda::HOG::setDescriptorFormat ( HOGDescriptor::DescriptorStorageFormat  descr_format)
pure virtual

Descriptor storage format:

  • DESCR_FORMAT_ROW_BY_ROW - Row-major order.
  • DESCR_FORMAT_COL_BY_COL - Column-major order.

◆ setGammaCorrection()

virtual void cv::cuda::HOG::setGammaCorrection ( bool  gamma_correction)
pure virtual

Flag to specify whether the gamma correction preprocessing is required or not.

◆ setGroupThreshold()

virtual void cv::cuda::HOG::setGroupThreshold ( int  group_threshold)
pure virtual

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()

virtual void cv::cuda::HOG::setHitThreshold ( double  hit_threshold)
pure virtual

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()

virtual void cv::cuda::HOG::setL2HysThreshold ( double  threshold_L2hys)
pure virtual

L2-Hys normalization method shrinkage.

◆ setNumLevels()

virtual void cv::cuda::HOG::setNumLevels ( int  nlevels)
pure virtual

Maximum number of detection window increases.

◆ setScaleFactor()

virtual void cv::cuda::HOG::setScaleFactor ( double  scale0)
pure virtual

Coefficient of the detection window increase.

◆ setSVMDetector()

virtual void cv::cuda::HOG::setSVMDetector ( InputArray  detector)
pure virtual

Sets coefficients for the linear SVM classifier.

◆ setWinSigma()

virtual void cv::cuda::HOG::setWinSigma ( double  win_sigma)
pure virtual

Gaussian smoothing window parameter.

◆ setWinStride()

virtual void cv::cuda::HOG::setWinStride ( Size  win_stride)
pure virtual

Window stride. It must be a multiple of block stride.


The documentation for this class was generated from the following file: