OpenCV453
公開型 | 公開メンバ関数 | 静的公開メンバ関数 | 公開変数類 | 全メンバ一覧
cv::HOGDescriptor 構造体

Implementation of HOG (Histogram of Oriented Gradients) descriptor and object detector. [詳解]

#include <objdetect.hpp>

公開型

enum  HistogramNormType { L2Hys = 0 }
 
enum  { DEFAULT_NLEVELS = 64 }
 
enum  DescriptorStorageFormat { DESCR_FORMAT_COL_BY_COL , DESCR_FORMAT_ROW_BY_ROW }
 

公開メンバ関数

CV_WRAP HOGDescriptor ()
 Creates the HOG descriptor and detector with default params. [詳解]
 
CV_WRAP HOGDescriptor (Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture=1, double _winSigma=-1, HOGDescriptor::HistogramNormType _histogramNormType=HOGDescriptor::L2Hys, double _L2HysThreshold=0.2, bool _gammaCorrection=false, int _nlevels=HOGDescriptor::DEFAULT_NLEVELS, bool _signedGradient=false)
 
CV_WRAP HOGDescriptor (const String &filename)
 
 HOGDescriptor (const HOGDescriptor &d)
 
virtual ~HOGDescriptor ()
 Default destructor.
 
CV_WRAP size_t getDescriptorSize () const
 Returns the number of coefficients required for the classification.
 
CV_WRAP bool checkDetectorSize () const
 Checks if detector size equal to descriptor size.
 
CV_WRAP double getWinSigma () const
 Returns winSigma value
 
virtual CV_WRAP void setSVMDetector (InputArray svmdetector)
 Sets coefficients for the linear SVM classifier. [詳解]
 
virtual bool read (FileNode &fn)
 Reads HOGDescriptor parameters from a cv::FileNode. [詳解]
 
virtual void write (FileStorage &fs, const String &objname) const
 Stores HOGDescriptor parameters in a cv::FileStorage. [詳解]
 
virtual CV_WRAP bool load (const String &filename, const String &objname=String())
 loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file. [詳解]
 
virtual CV_WRAP void save (const String &filename, const String &objname=String()) const
 saves HOGDescriptor parameters and coefficients for the linear SVM classifier to a file [詳解]
 
virtual void copyTo (HOGDescriptor &c) const
 clones the HOGDescriptor [詳解]
 
virtual CV_WRAP void compute (InputArray img, CV_OUT std::vector< float > &descriptors, Size winStride=Size(), Size padding=Size(), const std::vector< Point > &locations=std::vector< Point >()) const
 Computes HOG descriptors of given image. [詳解]
 
virtual CV_WRAP void detect (InputArray img, CV_OUT std::vector< Point > &foundLocations, CV_OUT std::vector< double > &weights, double hitThreshold=0, Size winStride=Size(), Size padding=Size(), const std::vector< Point > &searchLocations=std::vector< Point >()) const
 Performs object detection without a multi-scale window. [詳解]
 
virtual void detect (InputArray img, CV_OUT std::vector< Point > &foundLocations, double hitThreshold=0, Size winStride=Size(), Size padding=Size(), const std::vector< Point > &searchLocations=std::vector< Point >()) const
 Performs object detection without a multi-scale window. [詳解]
 
virtual CV_WRAP void detectMultiScale (InputArray img, CV_OUT std::vector< Rect > &foundLocations, CV_OUT std::vector< double > &foundWeights, double hitThreshold=0, Size winStride=Size(), Size padding=Size(), double scale=1.05, double finalThreshold=2.0, bool useMeanshiftGrouping=false) const
 Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. [詳解]
 
virtual void detectMultiScale (InputArray img, CV_OUT std::vector< Rect > &foundLocations, double hitThreshold=0, Size winStride=Size(), Size padding=Size(), double scale=1.05, double finalThreshold=2.0, bool useMeanshiftGrouping=false) const
 Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. [詳解]
 
virtual CV_WRAP void computeGradient (InputArray img, InputOutputArray grad, InputOutputArray angleOfs, Size paddingTL=Size(), Size paddingBR=Size()) const
 Computes gradients and quantized gradient orientations. [詳解]
 
virtual void detectROI (InputArray img, const std::vector< cv::Point > &locations, CV_OUT std::vector< cv::Point > &foundLocations, CV_OUT std::vector< double > &confidences, double hitThreshold=0, cv::Size winStride=Size(), cv::Size padding=Size()) const
 evaluate specified ROI and return confidence value for each location [詳解]
 
virtual void detectMultiScaleROI (InputArray img, CV_OUT std::vector< cv::Rect > &foundLocations, std::vector< DetectionROI > &locations, double hitThreshold=0, int groupThreshold=0) const
 evaluate specified ROI and return confidence value for each location in multiple scales [詳解]
 
void groupRectangles (std::vector< cv::Rect > &rectList, std::vector< double > &weights, int groupThreshold, double eps) const
 Groups the object candidate rectangles. [詳解]
 

静的公開メンバ関数

static CV_WRAP std::vector< float > getDefaultPeopleDetector ()
 Returns coefficients of the classifier trained for people detection (for 64x128 windows).
 
static CV_WRAP std::vector< float > getDaimlerPeopleDetector ()
 Returns coefficients of the classifier trained for people detection (for 48x96 windows).
 

公開変数類

CV_PROP Size winSize
 Detection window size. Align to block size and block stride. Default value is Size(64,128).
 
CV_PROP Size blockSize
 Block size in pixels. Align to cell size. Default value is Size(16,16).
 
CV_PROP Size blockStride
 Block stride. It must be a multiple of cell size. Default value is Size(8,8).
 
CV_PROP Size cellSize
 Cell size. Default value is Size(8,8).
 
CV_PROP int nbins
 Number of bins used in the calculation of histogram of gradients. Default value is 9.
 
CV_PROP int derivAperture
 not documented
 
CV_PROP double winSigma
 Gaussian smoothing window parameter.
 
CV_PROP HOGDescriptor::HistogramNormType histogramNormType
 histogramNormType
 
CV_PROP double L2HysThreshold
 L2-Hys normalization method shrinkage.
 
CV_PROP bool gammaCorrection
 Flag to specify whether the gamma correction preprocessing is required or not.
 
CV_PROP std::vector< float > svmDetector
 coefficients for the linear SVM classifier.
 
UMat oclSvmDetector
 coefficients for the linear SVM classifier used when OpenCL is enabled
 
float free_coef
 not documented
 
CV_PROP int nlevels
 Maximum number of detection window increases. Default value is 64
 
CV_PROP bool signedGradient
 Indicates signed gradient will be used or not
 

詳解

Implementation of HOG (Histogram of Oriented Gradients) descriptor and object detector.

the HOG descriptor algorithm introduced by Navneet Dalal and Bill Triggs [Dalal2005] .

useful links:

https://hal.inria.fr/inria-00548512/document/

https://en.wikipedia.org/wiki/Histogram_of_oriented_gradients

https://software.intel.com/en-us/ipp-dev-reference-histogram-of-oriented-gradients-hog-descriptor

http://www.learnopencv.com/histogram-of-oriented-gradients

http://www.learnopencv.com/handwritten-digits-classification-an-opencv-c-python-tutorial

列挙型メンバ詳解

◆ anonymous enum

anonymous enum
列挙値
DEFAULT_NLEVELS 

Default nlevels value.

◆ HistogramNormType

列挙値
L2Hys 

Default histogramNormType

構築子と解体子

◆ HOGDescriptor() [1/4]

CV_WRAP cv::HOGDescriptor::HOGDescriptor ( )
inline

Creates the HOG descriptor and detector with default params.

aqual to HOGDescriptor(Size(64,128), Size(16,16), Size(8,8), Size(8,8), 9 )

◆ HOGDescriptor() [2/4]

CV_WRAP cv::HOGDescriptor::HOGDescriptor ( Size  _winSize,
Size  _blockSize,
Size  _blockStride,
Size  _cellSize,
int  _nbins,
int  _derivAperture = 1,
double  _winSigma = -1,
HOGDescriptor::HistogramNormType  _histogramNormType = HOGDescriptor::L2Hys,
double  _L2HysThreshold = 0.2,
bool  _gammaCorrection = false,
int  _nlevels = HOGDescriptor::DEFAULT_NLEVELS,
bool  _signedGradient = false 
)
inline

これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。

引数
_winSizesets winSize with given value.
_blockSizesets blockSize with given value.
_blockStridesets blockStride with given value.
_cellSizesets cellSize with given value.
_nbinssets nbins with given value.
_derivAperturesets derivAperture with given value.
_winSigmasets winSigma with given value.
_histogramNormTypesets histogramNormType with given value.
_L2HysThresholdsets L2HysThreshold with given value.
_gammaCorrectionsets gammaCorrection with given value.
_nlevelssets nlevels with given value.
_signedGradientsets signedGradient with given value.

◆ HOGDescriptor() [3/4]

CV_WRAP cv::HOGDescriptor::HOGDescriptor ( const String &  filename)
inline

これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。

引数
filenameThe file name containing HOGDescriptor properties and coefficients for the linear SVM classifier.

◆ HOGDescriptor() [4/4]

cv::HOGDescriptor::HOGDescriptor ( const HOGDescriptor d)
inline

これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。

引数
dthe HOGDescriptor which cloned to create a new one.

関数詳解

◆ compute()

virtual CV_WRAP void cv::HOGDescriptor::compute ( InputArray  img,
CV_OUT std::vector< float > &  descriptors,
Size  winStride = Size(),
Size  padding = Size(),
const std::vector< Point > &  locations = std::vector< Point >() 
) const
virtual

Computes HOG descriptors of given image.

引数
imgMatrix of the type CV_8U containing an image where HOG features will be calculated.
descriptorsMatrix of the type CV_32F
winStrideWindow stride. It must be a multiple of block stride.
paddingPadding
locationsVector of Point

◆ computeGradient()

virtual CV_WRAP void cv::HOGDescriptor::computeGradient ( InputArray  img,
InputOutputArray  grad,
InputOutputArray  angleOfs,
Size  paddingTL = Size(),
Size  paddingBR = Size() 
) const
virtual

Computes gradients and quantized gradient orientations.

引数
imgMatrix contains the image to be computed
gradMatrix of type CV_32FC2 contains computed gradients
angleOfsMatrix of type CV_8UC2 contains quantized gradient orientations
paddingTLPadding from top-left
paddingBRPadding from bottom-right

◆ copyTo()

virtual void cv::HOGDescriptor::copyTo ( HOGDescriptor c) const
virtual

clones the HOGDescriptor

引数
ccloned HOGDescriptor

◆ detect() [1/2]

virtual CV_WRAP void cv::HOGDescriptor::detect ( InputArray  img,
CV_OUT std::vector< Point > &  foundLocations,
CV_OUT std::vector< double > &  weights,
double  hitThreshold = 0,
Size  winStride = Size(),
Size  padding = Size(),
const std::vector< Point > &  searchLocations = std::vector< Point >() 
) const
virtual

Performs object detection without a multi-scale window.

引数
imgMatrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
foundLocationsVector of point where each point contains left-top corner point of detected object boundaries.
weightsVector that will contain confidence values for each detected object.
hitThresholdThreshold 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.
winStrideWindow stride. It must be a multiple of block stride.
paddingPadding
searchLocationsVector of Point includes set of requested locations to be evaluated.

◆ detect() [2/2]

virtual void cv::HOGDescriptor::detect ( InputArray  img,
CV_OUT std::vector< Point > &  foundLocations,
double  hitThreshold = 0,
Size  winStride = Size(),
Size  padding = Size(),
const std::vector< Point > &  searchLocations = std::vector< Point >() 
) const
virtual

Performs object detection without a multi-scale window.

引数
imgMatrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
foundLocationsVector of point where each point contains left-top corner point of detected object boundaries.
hitThresholdThreshold 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.
winStrideWindow stride. It must be a multiple of block stride.
paddingPadding
searchLocationsVector of Point includes locations to search.

◆ detectMultiScale() [1/2]

virtual CV_WRAP void cv::HOGDescriptor::detectMultiScale ( InputArray  img,
CV_OUT std::vector< Rect > &  foundLocations,
CV_OUT std::vector< double > &  foundWeights,
double  hitThreshold = 0,
Size  winStride = Size(),
Size  padding = Size(),
double  scale = 1.05,
double  finalThreshold = 2.0,
bool  useMeanshiftGrouping = false 
) const
virtual

Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.

引数
imgMatrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
foundLocationsVector of rectangles where each rectangle contains the detected object.
foundWeightsVector that will contain confidence values for each detected object.
hitThresholdThreshold 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.
winStrideWindow stride. It must be a multiple of block stride.
paddingPadding
scaleCoefficient of the detection window increase.
finalThresholdFinal threshold
useMeanshiftGroupingindicates grouping algorithm

◆ detectMultiScale() [2/2]

virtual void cv::HOGDescriptor::detectMultiScale ( InputArray  img,
CV_OUT std::vector< Rect > &  foundLocations,
double  hitThreshold = 0,
Size  winStride = Size(),
Size  padding = Size(),
double  scale = 1.05,
double  finalThreshold = 2.0,
bool  useMeanshiftGrouping = false 
) const
virtual

Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.

引数
imgMatrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
foundLocationsVector of rectangles where each rectangle contains the detected object.
hitThresholdThreshold 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.
winStrideWindow stride. It must be a multiple of block stride.
paddingPadding
scaleCoefficient of the detection window increase.
finalThresholdFinal threshold
useMeanshiftGroupingindicates grouping algorithm

◆ detectMultiScaleROI()

virtual void cv::HOGDescriptor::detectMultiScaleROI ( InputArray  img,
CV_OUT std::vector< cv::Rect > &  foundLocations,
std::vector< DetectionROI > &  locations,
double  hitThreshold = 0,
int  groupThreshold = 0 
) const
virtual

evaluate specified ROI and return confidence value for each location in multiple scales

引数
imgMatrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
foundLocationsVector of rectangles where each rectangle contains the detected object.
locationsVector of DetectionROI
hitThresholdThreshold 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.
groupThresholdMinimum possible number of rectangles minus 1. The threshold is used in a group of rectangles to retain it.

◆ detectROI()

virtual void cv::HOGDescriptor::detectROI ( InputArray  img,
const std::vector< cv::Point > &  locations,
CV_OUT std::vector< cv::Point > &  foundLocations,
CV_OUT std::vector< double > &  confidences,
double  hitThreshold = 0,
cv::Size  winStride = Size(),
cv::Size  padding = Size() 
) const
virtual

evaluate specified ROI and return confidence value for each location

引数
imgMatrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
locationsVector of Point
foundLocationsVector of Point where each Point is detected object's top-left point.
confidencesconfidences
hitThresholdThreshold 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
winStridewinStride
paddingpadding

◆ groupRectangles()

void cv::HOGDescriptor::groupRectangles ( std::vector< cv::Rect > &  rectList,
std::vector< double > &  weights,
int  groupThreshold,
double  eps 
) const

Groups the object candidate rectangles.

引数
rectListInput/output vector of rectangles. Output vector includes retained and grouped rectangles. (The Python list is not modified in place.)
weightsInput/output vector of weights of rectangles. Output vector includes weights of retained and grouped rectangles. (The Python list is not modified in place.)
groupThresholdMinimum possible number of rectangles minus 1. The threshold is used in a group of rectangles to retain it.
epsRelative difference between sides of the rectangles to merge them into a group.

◆ load()

virtual CV_WRAP bool cv::HOGDescriptor::load ( const String &  filename,
const String &  objname = String() 
)
virtual

loads HOGDescriptor parameters and coefficients for the linear SVM classifier from a file.

引数
filenamePath of the file to read.
objnameThe optional name of the node to read (if empty, the first top-level node will be used).

◆ read()

virtual bool cv::HOGDescriptor::read ( FileNode fn)
virtual

Reads HOGDescriptor parameters from a cv::FileNode.

引数
fnFile node

◆ save()

virtual CV_WRAP void cv::HOGDescriptor::save ( const String &  filename,
const String &  objname = String() 
) const
virtual

saves HOGDescriptor parameters and coefficients for the linear SVM classifier to a file

引数
filenameFile name
objnameObject name

◆ setSVMDetector()

virtual CV_WRAP void cv::HOGDescriptor::setSVMDetector ( InputArray  svmdetector)
virtual

Sets coefficients for the linear SVM classifier.

引数
svmdetectorcoefficients for the linear SVM classifier.

◆ write()

virtual void cv::HOGDescriptor::write ( FileStorage fs,
const String &  objname 
) const
virtual

Stores HOGDescriptor parameters in a cv::FileStorage.

引数
fsFile storage
objnameObject name

この構造体詳解は次のファイルから抽出されました: