Open Detection  1.0
od::g2d::ODHOGDetector Class Reference

A linear classifier for HOG features. More...

#include <ODHOGDetector.h>

Inheritance diagram for od::g2d::ODHOGDetector:
Collaboration diagram for od::g2d::ODHOGDetector:

Public Member Functions

 OD_DEFINE_ENUM_WITH_STRING_CONVERSIONS (SVMType,(OD_CUSTOM)(OD_DEFAULT_PEOPLE)(OD_DAIMLER_PEOPLE)(OD_FILE)) ODHOGDetector(std
 
void init ()
 
void load (std::string filename)
 
void setSVMFromFile (std::string fileName)
 
void setSVMDetector (std::vector< float > svmdetector)
 
ODDetections2DdetectOmni (ODSceneImage *scene)
 Function for performing detection on an entire scene. More...
 
ODDetectionsdetect (ODSceneImage *scene)
 Function for performing detection on a segmented scene. More...
 
int detect (ODScene *scene, std::vector< ODDetection * > &detections)
 
void setTrainedDataLocation (std::string trained_data_location_)
 The base directory for trained data. More...
 
SVMType const & getSvmtype () const
 
void setSvmtype (SVMType const &svmtype_)
 
cv::Size const & getWinSize () const
 
void setWinSize (cv::Size const &winSize)
 
cv::Size const & getBlockSize () const
 
void setBlockSize (cv::Size const &blockSize)
 
cv::Size const & getBlockStride () const
 
void setBlockStride (cv::Size const &blockStride)
 
cv::Size const & getCellSize () const
 
void setCellSize (cv::Size const &cellSize)
 
float getHitThreshold () const
 
void setHitThreshold (float hitThreshold)
 
void printParameters ()
 
- Public Member Functions inherited from od::ODDetector2D
 ODDetector2D (std::string const &trained_data_location_)
 
ODDetectionsdetect (ODScene *scene)
 
- Public Member Functions inherited from od::ODDetector
 ODDetector (std::string const &training_data_location_)
 
virtual ODDetectionsdetectOmni (ODScene *scene)
 
- Public Member Functions inherited from od::ODDetectorCommon
 ODDetectorCommon (std::string const &trained_data_location_="")
 
std::string getTrainingInputLocation () const
 Gets/Sets the directory containing the data for training. More...
 
void setTrainingInputLocation (std::string training_input_location_)
 Gets/Sets the directory containing the data for training. More...
 
std::string getTrainedDataLocation () const
 Gets/Sets the base directory for trained data. More...
 
std::string getSpecificTrainingDataLocation ()
 Gets the specific directory for a Trainer or a Detector inside trained_data_location_. More...
 
std::string getSpecificTrainingData ()
 
std::string const & getTrainedDataID () const
 
void setTrainedDataID (std::string const &trainedDataID)
 

Protected Attributes

cv::Size winSize
 
cv::Size blockSize
 
cv::Size blockStride
 
cv::Size cellSize
 
float hitThreshold
 
cv::HOGDescriptor hog_
 
SVMType svmtype_
 
- Protected Attributes inherited from od::ODDetectorCommon
std::string training_input_location_
 
std::string trained_data_location_
 
std::string TRAINED_DATA_ID_
 
std::string TRAINED_LOCATION_DENTIFIER_
 

Additional Inherited Members

- Public Attributes inherited from od::ODDetector
bool metainfo_
 

Detailed Description

A linear classifier for HOG features.

This class takes an image as an input, finds its HOG features using the parameters containing in the trained data, runs the linear classifier (present in the trained data) on the computed HOG features and finally produces the classification output. Covers both multiscale detection (detectOmni()) and detection on a fixed scene (detect() - the scene is resized to the HOG window size).

Use ODHOGTrainer for the training of new objects. By default this class provides two people detector: OD_DEFAULT_PEOPLE, the people detector from OpenCV and OD_DAIMLER_PEOPLE, the second detector available from OpenCV. One can set any linear classifier, the linear weight vector through setSVMDetector() function but it is highly not recommended as the HOG parameters and the weight vector can be out of sync. One must set appropriate HOG parameters after using setSVMDetector() function with which the weight vector was trained.

Author
Kripasindhu Sarkar
Examples:
apps/global2D/od_multihog_app.cpp, objectdetector/od_hog_train.cpp, and objectdetector/od_image_hog_files.cpp.

Definition at line 60 of file ODHOGDetector.h.

Member Function Documentation

ODDetections* od::g2d::ODHOGDetector::detect ( ODSceneImage scene)
virtual

Function for performing detection on a segmented scene.

The purpose of this function is to perform detection on a segmented scene or an 'object candidate'. i.e. the entire scene is considered as an 'object' or an detection. It is possible for a scene to trigger multiple detections.

Parameters
[in]sceneAn instance of 2D scene
Returns
[out] detections A number of detections as an ODDetections instance.

Implements od::ODDetector2D.

int od::g2d::ODHOGDetector::detect ( ODScene scene,
std::vector< ODDetection * > &  detections 
)
inline

Definition at line 95 of file ODHOGDetector.h.

ODDetections2D* od::g2d::ODHOGDetector::detectOmni ( ODSceneImage scene)
virtual

Function for performing detection on an entire scene.

The purpose of this function is to detect an object in an entire scene. Thus, other than the type of detection we also have information about the location of the detection w.r.t. the scene.

Parameters
[in]sceneAn instance of 2D scene
Returns
[out] detections A number of detections as an ODDetections2D instance containing information about the detection and its 2D location.

Implements od::ODDetector2D.

Examples:
objectdetector/od_hog_train.cpp, and objectdetector/od_image_hog_files.cpp.
cv::Size const& od::g2d::ODHOGDetector::getBlockSize ( ) const
inline

Definition at line 125 of file ODHOGDetector.h.

References blockSize.

cv::Size const& od::g2d::ODHOGDetector::getBlockStride ( ) const
inline

Definition at line 135 of file ODHOGDetector.h.

References blockStride.

cv::Size const& od::g2d::ODHOGDetector::getCellSize ( ) const
inline

Definition at line 145 of file ODHOGDetector.h.

References cellSize.

float od::g2d::ODHOGDetector::getHitThreshold ( ) const
inline

Definition at line 155 of file ODHOGDetector.h.

References hitThreshold.

SVMType const& od::g2d::ODHOGDetector::getSvmtype ( ) const
inline

Definition at line 105 of file ODHOGDetector.h.

References svmtype_.

cv::Size const& od::g2d::ODHOGDetector::getWinSize ( ) const
inline

Definition at line 115 of file ODHOGDetector.h.

References winSize.

void od::g2d::ODHOGDetector::init ( )
virtual
void od::g2d::ODHOGDetector::load ( std::string  filename)
od::g2d::ODHOGDetector::OD_DEFINE_ENUM_WITH_STRING_CONVERSIONS ( SVMType  ,
(OD_CUSTOM)(OD_DEFAULT_PEOPLE)(OD_DAIMLER_PEOPLE)(OD_FILE)   
)
inline
void od::g2d::ODHOGDetector::printParameters ( )
void od::g2d::ODHOGDetector::setBlockSize ( cv::Size const &  blockSize)
inline

Definition at line 130 of file ODHOGDetector.h.

References blockSize.

void od::g2d::ODHOGDetector::setBlockStride ( cv::Size const &  blockStride)
inline

Definition at line 140 of file ODHOGDetector.h.

References blockStride.

void od::g2d::ODHOGDetector::setCellSize ( cv::Size const &  cellSize)
inline

Definition at line 150 of file ODHOGDetector.h.

References cellSize.

void od::g2d::ODHOGDetector::setHitThreshold ( float  hitThreshold)
inline

Definition at line 160 of file ODHOGDetector.h.

References hitThreshold.

void od::g2d::ODHOGDetector::setSVMDetector ( std::vector< float >  svmdetector)
inline

Definition at line 87 of file ODHOGDetector.h.

References hog_.

void od::g2d::ODHOGDetector::setSVMFromFile ( std::string  fileName)
void od::g2d::ODHOGDetector::setSvmtype ( SVMType const &  svmtype_)
inline
Examples:
apps/global2D/od_multihog_app.cpp.

Definition at line 110 of file ODHOGDetector.h.

References svmtype_.

void od::g2d::ODHOGDetector::setTrainedDataLocation ( std::string  trained_data_location_)
inlinevirtual

The base directory for trained data.

This should be same for all Trainers and Detectors and can be considered as the 'database' of trained data. Trainers uses one of its subdirectories based on its type to store algo specific trained data. The corresponding Detector would use the same directory to fetch the trained data for online detection.

Reimplemented from od::ODDetectorCommon.

Examples:
objectdetector/od_hog_train.cpp, and objectdetector/od_image_hog_files.cpp.

Definition at line 99 of file ODHOGDetector.h.

References svmtype_, and od::ODDetectorCommon::trained_data_location_.

void od::g2d::ODHOGDetector::setWinSize ( cv::Size const &  winSize)
inline

Definition at line 120 of file ODHOGDetector.h.

References winSize.

Member Data Documentation

cv::Size od::g2d::ODHOGDetector::blockSize
protected

Definition at line 170 of file ODHOGDetector.h.

Referenced by getBlockSize(), and setBlockSize().

cv::Size od::g2d::ODHOGDetector::blockStride
protected

Definition at line 171 of file ODHOGDetector.h.

Referenced by getBlockStride(), and setBlockStride().

cv::Size od::g2d::ODHOGDetector::cellSize
protected

Definition at line 172 of file ODHOGDetector.h.

Referenced by getCellSize(), and setCellSize().

float od::g2d::ODHOGDetector::hitThreshold
protected

Definition at line 174 of file ODHOGDetector.h.

Referenced by getHitThreshold(), and setHitThreshold().

cv::HOGDescriptor od::g2d::ODHOGDetector::hog_
protected

Definition at line 176 of file ODHOGDetector.h.

Referenced by setSVMDetector().

SVMType od::g2d::ODHOGDetector::svmtype_
protected
cv::Size od::g2d::ODHOGDetector::winSize
protected

Definition at line 169 of file ODHOGDetector.h.

Referenced by getWinSize(), and setWinSize().


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