2011-01-17 14:57:57 +08:00
\section { Object Detection}
\cvclass { gpu::HOGDescriptor}
Histogram of Oriented Gradients descriptor and detector.
\begin { lstlisting}
struct CV_ EXPORTS HOGDescriptor
{
enum { DEFAULT_ WIN_ SIGMA = -1 } ;
enum { DEFAULT_ NLEVELS = 64 } ;
enum { DESCR_ FORMAT_ ROW_ BY_ ROW, DESCR_ FORMAT_ COL_ BY_ COL } ;
HOGDescriptor(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, double win_ sigma=DEFAULT_ WIN_ SIGMA,
double threshold_ L2hys=0.2, bool gamma_ correction=true,
int nlevels=DEFAULT_ NLEVELS);
size_ t getDescriptorSize() const;
size_ t getBlockHistogramSize() const;
void setSVMDetector(const vector<float>& detector);
static vector<float> getDefaultPeopleDetector();
static vector<float> getPeopleDetector48x96();
static vector<float> getPeopleDetector64x128();
void detect(const GpuMat& img, vector<Point>& found_ locations,
double hit_ threshold=0, Size win_ stride=Size(),
Size padding=Size());
void detectMultiScale(const GpuMat& img, vector<Rect>& found_ locations,
double hit_ threshold=0, Size win_ stride=Size(),
Size padding=Size(), double scale0=1.05,
int group_ threshold=2);
void getDescriptors(const GpuMat& img, Size win_ stride,
GpuMat& descriptors,
int descr_ format=DESCR_ FORMAT_ COL_ BY_ COL);
Size win_ size;
Size block_ size;
Size block_ stride;
Size cell_ size;
int nbins;
double win_ sigma;
double threshold_ L2hys;
bool gamma_ correction;
int nlevels;
private:
// Hidden
}
\end { lstlisting}
Interfaces of all methods are kept similar to CPU HOG descriptor and detector's analogues as much as possible.
\cvCppFunc { gpu::HOGDescriptor::HOGDescriptor}
Creates HOG descriptor and detector.
\cvdefCpp { HOGDescriptor(Size win\_ size=Size(64, 128), Size block\_ size=Size(16, 16),\par
Size block\_ stride=Size(8, 8), Size cell\_ size=Size(8, 8),\par
int nbins=9, double win\_ sigma=DEFAULT\_ WIN\_ SIGMA,\par
double threshold\_ L2hys=0.2, bool gamma\_ correction=true,\par
int nlevels=DEFAULT\_ NLEVELS);}
\begin { description}
\cvarg { win\_ size} { Detection window size. Must be aligned to block size and block stride.}
\cvarg { block\_ size} { Block size in cells. Only (2,2) is supported for now.}
\cvarg { block\_ stride} { Block stride. Must be a multiple of cell size.}
\cvarg { cell\_ size} { Cell size. Only (8, 8) is supported for now.}
\cvarg { nbins} { Number of bins. Only 9 bins per cell is supported for now.}
\cvarg { win\_ sigma} { Gaussian smoothing window parameter.}
\cvarg { threshold\_ L2Hys} { L2-Hys normalization method shrinkage.}
\cvarg { gamma\_ correction} { Do gamma correction preprocessing or not.}
\cvarg { nlevels} { Maximum number of detection window increases.}
\end { description}
\cvCppFunc { gpu::HOGDescriptor::getDescriptorSize}
Returns number of coefficients required for the classification.
\cvdefCpp { size\_ t getDescriptorSize() const;}
\cvCppFunc { gpu::HOGDescriptor::getBlockHistogramSize}
Returns block histogram size.
\cvdefCpp { size\_ t getBlockHistogramSize() const;}
\cvCppFunc { gpu::HOGDescriptor::setSVMDetector}
Sets coefficients for the linear SVM classifier.
\cvdefCpp { void setSVMDetector(const vector<float>\& detector);}
\cvCppFunc { gpu::HOGDescriptor::getDefaultPeopleDetector}
Returns coefficients of the classifier trained for people detection (for default window size).
\cvdefCpp { static vector<float> getDefaultPeopleDetector();}
\cvCppFunc { gpu::HOGDescriptor::getPeopleDetector48x96}
Returns coefficients of the classifier trained for people detection (for 48x96 windows).
\cvdefCpp { static vector<float> getPeopleDetector48x96();}
\cvCppFunc { gpu::HOGDescriptor::getPeopleDetector64x128}
Returns coefficients of the classifier trained for people detection (for 64x128 windows).
\cvdefCpp { static vector<float> getPeopleDetector64x128();}
\cvCppFunc { gpu::HOGDescriptor::detect}
Perfroms object detection without increasing detection window.
\cvdefCpp { void detect(const GpuMat\& img, vector<Point>\& found\_ locations,\par
double hit\_ threshold=0, Size win\_ stride=Size(),\par
Size padding=Size());}
\begin { description}
2011-01-17 20:09:47 +08:00
\cvarg { img} { Source image. \texttt { CV\_ 8UC1} and \texttt { CV\_ 8UC4} types are supported for now.}
2011-01-17 14:57:57 +08:00
\cvarg { found\_ locations} { Will contain left-top corner points of detected objects boundaries.}
\cvarg { hit\_ threshold} { Threshold for the distance between features and classifying plane. Usually it's 0, and should be specfied in the detector coefficients (as the last free coefficient), but if the free coefficient is missed (it's allowed) you can specify it manually here.}
\cvarg { win\_ stride} { Window stride. Must be a multiple of block stride.}
\cvarg { padding} { Mock parameter to keep CPU interface compatibility. Must be (0,0).}
\end { description}
\cvCppFunc { gpu::HOGDescriptor::detectMultiScale}
2011-01-17 17:27:01 +08:00
Perfroms object detection several times with preliminary increase of detection window.
2011-01-17 14:57:57 +08:00
\cvdefCpp { void detectMultiScale(const GpuMat\& img, vector<Rect>\& found\_ locations,\par
double hit\_ threshold=0, Size win\_ stride=Size(),\par
Size padding=Size(), double scale0=1.05,\par
int group\_ threshold=2);}
\begin { description}
\cvarg { img} { Source image. See \cvCppCross { gpu::HOGDescriptor::detect} for type limitations.}
\cvarg { found\_ locations} { Will contain detected objects boundaries.}
\cvarg { hit\_ threshold} { The threshold for the distance between features and classifying plane. See \cvCppCross { gpu::HOGDescriptor::detect} for details.}
\cvarg { win\_ stride} { Window stride. Must be a multiple of block stride.}
\cvarg { padding} { Mock parameter to keep CPU interface compatibility. Must be (0,0).}
\cvarg { scale0} { Coefficient of the detection window increase.}
\cvarg { group\_ threshold} { After detection some objects could be covered by many rectangles. This coefficient regulates similarity threshold. 0 means don't perform grouping.\newline
See \cvCppCross { groupRectangles} .}
\end { description}
\cvCppFunc { gpu::HOGDescriptor::getDescriptors}
Returns block descriptors computed for the whole image.
\cvdefCpp { void getDescriptors(const GpuMat\& img, Size win\_ stride,\par
GpuMat\& descriptors,\par
int descr\_ format=DESCR\_ FORMAT\_ COL\_ BY\_ COL);}
\begin { description}
\cvarg { img} { Source image. See \cvCppCross { gpu::HOGDescriptor::detect} for type limitations.}
\cvarg { win\_ stride} { Window stride. Must be a multiple of block stride.}
\cvarg { descriptors} { 2D array of descriptors.}
\cvarg { descr\_ format} { Descriptor storage format:
\begin { description}
\cvarg { DESCR\_ FORMAT\_ ROW\_ BY\_ ROW} { Row-major order.}
\cvarg { DESCR\_ FORMAT\_ COL\_ BY\_ COL} { Column-major order.}
\end { description} }
\end { description}