# opentl::modalities::HistoOrientedGrad Class Reference

Visual modality: Histogram of Oriented Gradients (HOG) This class implements the HOG on a reference pattern, to be matched to the current image It uses the integral HOG in order to speed up computations for multiple evaluations (e.g. particle filters) on a rectangular bounding box at a given pose. More...

Inherits opentl::modalities::Modality.

List of all members.

## Public Types
## Public Member Functions
virtual HistoOrientedGrad * | clone () const
| clone the current HistoOrientedGrad class instance
virtual int | copyMTrack2MDetect (const TargetPtrVector &targets)
| copy corresponding Mtrack features of a state to Mdetect
| HistoOrientedGrad (const HistoOrientedGrad &c)
| Copy Constructor.
| HistoOrientedGrad (opentl::modelprojection::Warp *warp, int camIdx)
| Constructor.
virtual void | init ()
| Needed init() method for parameter handling.
virtual int | matchFeatLevel (const TargetPtrVector &targets, T_MEAS_FEATPtrVector &outputMeas, std::size_t partitionIdx)
| Matching on feature level match projected model features with detected image features.
virtual int | matchObjLevel (const TargetPtrVector &targets, T_MEAS_OBJPtrVector &outputMeas, std::size_t partitionIdx)
| Matching on object level compute a local, maximum-likelihood estimate of pose (evtl. state), using either pixel- or feature-level likelihood functions.
virtual int | preProcess (const opentl::core::cvdata::Image &image, const std::vector< std::vector< int > > &preProcessROIs)
| Compute integral HOG of the current image.
virtual int | sampleModelFeatures (const TargetPtrVector &targets)
| Sample the HOG from the shape and appearance model.
virtual int | updateModelFeatures (const TargetPtrVector &targets)
| Update online reference HOG from the estimated state and the current image.
virtual | ~HistoOrientedGrad ()
| Destructor.
## Protected Member Functions
virtual void | computeModelFeatureFromImageGradients (std::vector< double > &MDestination, const IplImage *imgGradx, const IplImage *imgGrady, int offsetx, int offsety, int width, int height)
| computes the model features using gradient images for input
virtual void | computeModelFeatureFromIntegralHistogram (boost::shared_ptr< opentl::core::State > state, const boost::shared_ptr< opentl::models::ObjModel > &objModel, std::vector< double > &MDestination)
| computes the model features using a precomputed integral histogram for input

## Detailed Description

Visual modality: Histogram of Oriented Gradients (HOG) This class implements the HOG on a reference pattern, to be matched to the current image It uses the integral HOG in order to speed up computations for multiple evaluations (e.g. particle filters) on a rectangular bounding box at a given pose.

Pixel-level match: (not available) Feature-level match: Bhattacharyya distance between HOGs Object-level match: Brute-force search in discrete state space (N-box)

Author: Giorgio Panin (panin@in.tum.de)

## Member Enumeration Documentation

enum opentl::modalities::HistoOrientedGrad::OfflineParameters

Parameters for visual processing in this class.

Enumerator:

  paramNcell | Number of histogram cells (default: 9).
  OFFLINE_COUNT |

Reimplemented from opentl::modalities::Modality.

enum opentl::modalities::HistoOrientedGrad::OnlineParameters

Enumerator:

  aperture_size | Sobel filter aperture size (default: 3) Size of the Sobel kernel (must be 1, 3, 5 or 7).
  invCovFeat | Inverse variance of residual distance (feature-level).
  typeFeatureResidual | Metric of feature-level residual.
  matchFeatMdetectWeight | weight for Moffline/Mdetect distance (must be 1-matchFeatMtrackWeight)
  matchFeatMtrackWeight | weight for Monline/Mtrack distance (must be 1-matchFeatMdetectWeight)
  matchFeatWithMdetect | specify the residual fusion: use Moffline/Mdetect
  matchFeatWithMtrack | specify the residual fusion: use Monline/Mtrack
  ONLINE_COUNT |

Reimplemented from opentl::modalities::Modality.

enum opentl::modalities::HistoOrientedGrad::T_FEATURE_RES

Enumerator:

  BHAT |
  EUCLID |

## Constructor & Destructor Documentation

opentl::modalities::HistoOrientedGrad::HistoOrientedGrad | ( | opentl::modelprojection::Warp * | warp,
|  | int | camIdx |
| ) |  |  |

Constructor.

Parameters:

  | warp | pointer to the warp
  | camIdx | camera index for this modality

opentl::modalities::HistoOrientedGrad::HistoOrientedGrad | ( | const HistoOrientedGrad & | c | ) |

Copy Constructor.

Parameters:

  | c | reference HistoOrientedGrad class to copy from

virtual opentl::modalities::HistoOrientedGrad::~HistoOrientedGrad | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

virtual HistoOrientedGrad* opentl::modalities::HistoOrientedGrad::clone | ( |  | ) | const`[inline, virtual]`

clone the current HistoOrientedGrad class instance

Returns:
  a pointer to a cloned class instance

Implements opentl::modalities::Modality.

virtual void opentl::modalities::HistoOrientedGrad::computeModelFeatureFromImageGradients | ( | std::vector< double > & | MDestination,
|  | const IplImage * | imgGradx,
|  | const IplImage * | imgGrady,
|  | int | offsetx,
|  | int | offsety,
|  | int | width,
|  | int | height |
| ) |  |  | `[protected, virtual]`

computes the model features using gradient images for input

Parameters:

  | MDestination | Destination model feature storage container
  | imgGradx | Gradient image in x direction
  | imgGrady | Gradient image in y direction
  | offsetx | position (x) of the lower left corner of the rectangle to sample from
  | offsety | position (y) of the lower left corner of the rectangle to sample from
  | width | width of the rectangle to sample from
  | height | height of the rectangle to sample from

virtual void opentl::modalities::HistoOrientedGrad::computeModelFeatureFromIntegralHistogram | ( | boost::shared_ptr< opentl::core::State > | state,
|  | const boost::shared_ptr< opentl::models::ObjModel > & | objModel,
|  | std::vector< double > & | MDestination |
| ) |  |  | `[protected, virtual]`

computes the model features using a precomputed integral histogram for input

Parameters:

  | state | vector of states to consider for sampling
  | MDestination | Destination model feature storage container

virtual int opentl::modalities::HistoOrientedGrad::copyMTrack2MDetect | ( | const TargetPtrVector & | targets | ) | `[virtual]`

copy corresponding Mtrack features of a state to Mdetect

Parameters:

  | states | states vector that should be considered for copying the corresponding features

virtual void opentl::modalities::HistoOrientedGrad::init | ( |  | ) | `[virtual]`

Needed init() method for parameter handling.

Reimplemented from opentl::modalities::Modality.

virtual int opentl::modalities::HistoOrientedGrad::matchFeatLevel | ( | const TargetPtrVector & | targets,
|  | T_MEAS_FEATPtrVector & | outputMeas,
|  | std::size_t | partitionIdx |
| ) |  |  | `[virtual]`

Matching on feature level

- match projected model features with detected image features.

Parameters:

  | states | Predicted state
  | outputMeas | Feature-space measurements and residuals

Reimplemented from opentl::modalities::Modality.

virtual int opentl::modalities::HistoOrientedGrad::matchObjLevel | ( | const TargetPtrVector & | targets,
|  | T_MEAS_OBJPtrVector & | outputMeas,
|  | std::size_t | partitionIdx |
| ) |  |  | `[inline, virtual]`

Matching on object level

- compute a local, maximum-likelihood estimate of pose (evtl. state), using either pixel- or feature-level likelihood functions.

Parameters:

  | states | Predicted state
  | outputMeas | State-space measurement and residuals (expected state = prediction, observed state = ML estimate)

Reimplemented from opentl::modalities::Modality.

virtual int opentl::modalities::HistoOrientedGrad::preProcess | ( | const opentl::core::cvdata::Image & | image,
|  | const std::vector< std::vector< int > > & | preProcessROIs |
| ) |  |  | `[virtual]`

Compute integral HOG of the current image.

Parameters:

  | image | Input sensor data (e.g. camera image in RGB)
  | preProcessROIs | Regions of interest (x0,y0,width,height), per target

Reimplemented from opentl::modalities::Modality.

virtual int opentl::modalities::HistoOrientedGrad::sampleModelFeatures | ( | const TargetPtrVector & | targets | ) | `[virtual]`

Sample the HOG from the shape and appearance model.

Parameters:

  | states | states vector that should be samples from

Reimplemented from opentl::modalities::Modality.

virtual int opentl::modalities::HistoOrientedGrad::updateModelFeatures | ( | const TargetPtrVector & | targets | ) | `[virtual]`

Update online reference HOG from the estimated state and the current image.

Parameters:

  | states | states vector that should be samples from

Reimplemented from opentl::modalities::Modality.