class cv::cuda::HOG
Overview
The class implements Histogram of Oriented Gradients ([17]) object detector. Moreā¦
#include <cudaobjdetect.hpp> class HOG: public cv::Algorithm { public: // enums enum { DESCR_FORMAT_ROW_BY_ROW, DESCR_FORMAT_COL_BY_COL, }; // methods static Ptr<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 ); virtual void compute( InputArray img, OutputArray descriptors, Stream& stream = Stream::Null() ) = 0; virtual void detect( InputArray img, std::vector<Point>& found_locations, std::vector<double>* confidences = NULL ) = 0; virtual void detectMultiScale( InputArray img, std::vector<Rect>& found_locations, std::vector<double>* confidences = NULL ) = 0; virtual size_t getBlockHistogramSize() const = 0; virtual Mat getDefaultPeopleDetector() const = 0; virtual int getDescriptorFormat() const = 0; virtual size_t getDescriptorSize() const = 0; 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(int descr_format) = 0; virtual void setGammaCorrection(bool gamma_correction) = 0; virtual void setGroupThreshold(int group_threshold) = 0; virtual void setHitThreshold(double hit_threshold) = 0; virtual void setL2HysThreshold(double threshold_L2hys) = 0; virtual void setNumLevels(int nlevels) = 0; virtual void setScaleFactor(double scale0) = 0; virtual void setSVMDetector(InputArray detector) = 0; virtual void setWinSigma(double win_sigma) = 0; virtual void setWinStride(Size win_stride) = 0; };
Inherited Members
public: // methods virtual void clear(); virtual bool empty() const; virtual String getDefaultName() const; virtual void read(const FileNode& fn); virtual void save(const String& filename) const; virtual void write(FileStorage& fs) const; template <typename _Tp> static Ptr<_Tp> load( const String& filename, const String& objname = String() ); template <typename _Tp> static Ptr<_Tp> loadFromString( const String& strModel, const String& objname = String() ); template <typename _Tp> static Ptr<_Tp> read(const FileNode& fn); protected: // methods void writeFormat(FileStorage& fs) const;
Detailed Documentation
The class implements Histogram of Oriented Gradients ([17]) object detector.
- 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
Methods
static Ptr<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. |
virtual void compute( InputArray img, OutputArray descriptors, Stream& stream = Stream::Null() ) = 0
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. |
virtual void detect( InputArray img, std::vector<Point>& found_locations, std::vector<double>* confidences = NULL ) = 0
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. |
virtual void detectMultiScale( InputArray img, std::vector<Rect>& found_locations, std::vector<double>* confidences = NULL ) = 0
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. |
virtual size_t getBlockHistogramSize() const = 0
Returns the block histogram size.
virtual Mat getDefaultPeopleDetector() const = 0
Returns coefficients of the classifier trained for people detection.
virtual size_t getDescriptorSize() const = 0
Returns the number of coefficients required for the classification.
virtual void setDescriptorFormat(int descr_format) = 0
Descriptor storage format:
- DESCR_FORMAT_ROW_BY_ROW - Row-major order.
- DESCR_FORMAT_COL_BY_COL - Column-major order.
virtual void setGammaCorrection(bool gamma_correction) = 0
Flag to specify whether the gamma correction preprocessing is required or not.
virtual void setGroupThreshold(int group_threshold) = 0
Coefficient to regulate the similarity threshold. When detected, some objects can be covered by many rectangles. 0 means not to perform grouping. See groupRectangles.
virtual void setHitThreshold(double hit_threshold) = 0
Threshold for the distance between features and SVM classifying plane. Usually it is 0 and should be specfied 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.
virtual void setL2HysThreshold(double threshold_L2hys) = 0
L2-Hys normalization method shrinkage.
virtual void setNumLevels(int nlevels) = 0
Maximum number of detection window increases.
virtual void setScaleFactor(double scale0) = 0
Coefficient of the detection window increase.
virtual void setSVMDetector(InputArray detector) = 0
Sets coefficients for the linear SVM classifier.
virtual void setWinSigma(double win_sigma) = 0
Gaussian smoothing window parameter.
virtual void setWinStride(Size win_stride) = 0
Window stride. It must be a multiple of block stride.