# opentl::modalities::ColourHist2D Class Reference

Inherits opentl::modalities::Modality.

List of all members.

## Public Types
## Public Member Functions
virtual modalities::Modality * | clone () const
| Creates an additional copy of this class instance.
| ColourHist2D (const ColourHist2D &c)
| Copy Constructor (deep copy).
| ColourHist2D (opentl::modelprojection::Warp *warp, int camIdx, opentl::modelprojection::GLRenderer *renderer=NULL)
| Constructor.
virtual int | copyMTrack2MDetect (const TargetPtrVector *targets)
| Copy the on-line histogram (Mtrack) into the off-line one (Mdetect).
void | getRotatedImageOfLink (const boost::shared_ptr< opentl::core::State > &state, const boost::shared_ptr< models::ObjModel > &objModel, double &x, double &y, double &width, double &height, int linkIdx)
| Compute the rotated bounding box of one or more faces, and fills a binary mask (white inside the rotated box, black outside) NOTE: the mask image is processed only within the bounding region of the projected face, while the rest is left unchanged.
opentl::core::cvdata::Image & | getSegmentationImage (std::size_t targetId)
virtual void | init ()
| Initialization function.
virtual int | matchFeatLevel (const TargetPtrVector &targets, T_MEAS_FEATPtrVector &outputMeas, std::size_t partitionIdx)
| Match model and image color histograms, under a given pose hypothesis.
virtual int | matchPixLevel (const TargetPtrVector &targets, T_MEAS_PIXPtrVector &outputMeas, std::size_t partitionIdx)
| Matching on pixel level compute the histogram back-projection of the HSV image.
virtual int | preProcess (const opentl::core::cvdata::Image &image, const std::vector< std::vector< int > > &preProcessROIs)
| Converts a given Image into the specified color space To specify the destination color space, please use the param construct.
virtual int | sampleModelFeatures (const TargetPtrVector &targets)
| Sample color histogram from shape and appearance model, at given pose.
virtual int | updateModelFeatures (const TargetPtrVector &targets)
| Update on-line color histogram from pre-processed image, at given pose.
virtual | ~ColourHist2D ()
| Destructor.
## Static Public Attributes
static std::vector < std::vector< std::vector < opentl::core::cvdata::ColourHist2d > > > | mColourHist2DFeatures_z
| Storage for _temp._ image color histogram First camera index, 2nd target id, 3rd face index.
static std::vector < std::vector< std::vector < opentl::core::cvdata::ColourHist2d > > > | mColourHist2DMdetect
| Storage for reference color histogram (off-line, from SampleModelFeatures) One histogram per: target and patch The first index specifies the camera index, the second index specifies the targetid, 3rd index faceid.
static std::vector < std::vector< std::vector < opentl::core::cvdata::ColourHist2d > > > | mColourHist2DMtrack
| Storage for reference color histogram (on-line, from UpdateModelFeatures) One histogram per: target and patch The first index specifies the camera index, the second index specifies the targetid, 3rd index faceid.
static std::vector < boost::shared_ptr < opentl::core::cvdata::Image > > | mColourHist2DStaticDataImage
static std::vector < boost::shared_ptr < cvprocess::ColorHistShader > > | mHistoShaders
| Shader for computing the color histogram on the GPU.
static std::vector < boost::shared_ptr < cvprocess::ColorHistSum > > | mHistoSumShaders
| Shader for summing up partial color histograms on the GPU.
static std::vector < boost::shared_ptr < opentl::core::cvdata::TextureGpu > > | mInputTextures
| Texture to copy the input image on the GPU.
static std::vector < boost::shared_ptr < opentl::core::cvdata::TextureGpu > > | mShadowTextures
| Texture for the object shadow (mask) GPU.
## Protected Member Functions
virtual void | getImageHistogram (const boost::shared_ptr< opentl::core::State > &state, const boost::shared_ptr< models::ObjModel > &objModel, std::vector< opentl::core::cvdata::ColourHist2d > &MDestination)
| Sample color histogram from image pixels, using either CPU- or GPU-based implementation, for a given shadow type.

## Member Enumeration Documentation

enum opentl::modalities::ColourHist2D::OfflineParameters

Parameters for visual processing in this class.

Enumerator:

  preProcess_DestColorFormat | Color channels of pre-processed image (default: HSV).
  sampleModelFeatures_Bins1 | (int) Size of the histogram for the first color channel
  sampleModelFeatures_Bins2 | (int) Size of the histogram for the second color channel
  sampleModelFeatures_Bins3 | (int) Size of the histogram for the third color channel
  computeVectorResidual | (bool) Whether to compute a scalar (Bhattacharyya distance) or vector (histogram difference) residual
  matchFeatShadowType | (shadowType) Type of matching shadow mask (bounding box, etc.) for the histogram
  matchFeatUseHistogramGPU | (bool) Whether to use the GPU for computing the histogram itself (using shaders)
  OFFLINE_COUNT |

Reimplemented from opentl::modalities::Modality.

enum opentl::modalities::ColourHist2D::OnlineParameters

Enumerator:

  matchPixVariance | (double) Variance of pixel-level measurement residual
  matchPixBinaryThreshold | (double) Binary segmentation threshold in [0.0,1.0] (default = -1: no thresholding, all grey levels are kept)
  matchPixUsingResidualImage | (bool) Whether to compute the full residual image, or just a scalar (count of white pixels)
  matchPixHandlingOcclusions | (bool) Whether to handle mutual occlusions between targets or not, during pixel matching (default: false)
  matchFeatVariance | (double) Variance of feature-level measurement residual (scalar or vector case)
  matchFeatWithMdetect | (bool) Whether to use the off-line reference histogram
  matchFeatWithMtrack | (bool) Whether to use the on-line reference histogram
  matchFeatMdetectWeight | (double) Weight for the off-line reference histogram (obtained by sampleModelFeatures) during the matching
  matchFeatMtrackWeight | (double) Weight for the on-line reference histogram (obtained by updateModelFeatures) during the matching
  matchFeatHandlingOcclusions | (bool) Whether to handle mutual occlusions between targets or not, during histogram matching (default: false)
  ONLINE_COUNT |

Reimplemented from opentl::modalities::Modality.

enum opentl::modalities::ColourHist2D::shadowType

Type of projected shadow mask, for collecting histograms.

Enumerator:

  BOUNDING_BOX | Straight-up bounding box (default).
  ROTATED_BOX | Minimum-area, rotated bounding box.
  BOUNDING_CIRCLE | Screen bounding circle.
  FULL_SHADOW | Projected screen shadow, using OpenGL.

## Constructor & Destructor Documentation

opentl::modalities::ColourHist2D::ColourHist2D | ( | opentl::modelprojection::Warp * | warp,
|  | int | camIdx,
|  | opentl::modelprojection::GLRenderer * | renderer = `NULL` |
| ) |  |  |

Constructor.

Parameters:

  | warp | Warp instance
  | camIdx | Camera index
  | Pointer | to the GLRenderer instance, if the full object shadow is used while sampling the histogram

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

Copy Constructor (deep copy).

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

Destructor.

## Member Function Documentation

virtual modalities::Modality* opentl::modalities::ColourHist2D::clone | ( |  | ) | const`[virtual]`

Creates an additional copy of this class instance.

Implements opentl::modalities::Modality.

virtual int opentl::modalities::ColourHist2D::copyMTrack2MDetect | ( | const TargetPtrVector * | targets | ) | `[virtual]`

Copy the on-line histogram (Mtrack) into the off-line one (Mdetect).

Parameters:

  | targets | Vector of targets

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

Sample color histogram from image pixels, using either CPU- or GPU-based implementation, for a given shadow type.

Parameters:

  | state | Object state (single-target)
  | objModel | Object model
  | MDestination | Destination histogram
  | bSetModelPoints | Whether to set model points inside the Warp, before calling getScreenBoundingLimits

void opentl::modalities::ColourHist2D::getRotatedImageOfLink | ( | const boost::shared_ptr< opentl::core::State > & | state,
|  | const boost::shared_ptr< models::ObjModel > & | objModel,
|  | double & | x,
|  | double & | y,
|  | double & | width,
|  | double & | height,
|  | int | linkIdx |
| ) |  |  |

Compute the rotated bounding box of one or more faces, and fills a binary mask (white inside the rotated box, black outside) NOTE: the mask image is processed only within the bounding region of the projected face, while the rest is left unchanged.

Parameters:

  | state | State hypothesis
  | objModel | Object model
  | (x,y,width,height) | Output coordinates of the upright bounding box
  | linkIdx | Link Id
  | bSetModelPoints | Whether to set model points inside the Warp, before calling getScreenBoundingLimits

opentl::core::cvdata::Image& opentl::modalities::ColourHist2D::getSegmentationImage | ( | std::size_t | targetId | ) |

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

Initialization function.

Reimplemented from opentl::modalities::Modality.

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

Match model and image color histograms, under a given pose hypothesis.

Parameters:

  | targets | Vector of targets
  | outputMeas | Each one is a set of Bhattacharyya distances (residuals) between model and image histograms, for all patches

Reimplemented from opentl::modalities::Modality.

virtual int opentl::modalities::ColourHist2D::matchPixLevel | ( | const TargetPtrVector & | targets,
|  | T_MEAS_PIXPtrVector & | outputMeas,
|  | std::size_t | partitionIdx |
| ) |  |  | `[virtual]`

Matching on pixel level

- compute the histogram back-projection of the HSV image.

Parameters:

  | targets | Vector of targets
  | outputMeas | Pixel-space measurement (can be a pixel map of residuals, or a unique residual value)

Reimplemented from opentl::modalities::Modality.

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

Converts a given Image into the specified color space To specify the destination color space, please use the param construct.

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::ColourHist2D::sampleModelFeatures | ( | const TargetPtrVector & | targets | ) | `[virtual]`

Sample color histogram from shape and appearance model, at given pose.

Parameters:

  | targets | Vector of targets

Reimplemented from opentl::modalities::Modality.

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

Update on-line color histogram from pre-processed image, at given pose.

Parameters:

  | targets | Vector of targets

Reimplemented from opentl::modalities::Modality.

## Member Data Documentation

std::vector<std::vector<std::vector<opentl::core::cvdata::ColourHist2d> > > opentl::modalities::ColourHist2D::mColourHist2DFeatures_z`[static]`

Storage for _temp._ image color histogram First camera index, 2nd target id, 3rd face index.

std::vector<std::vector<std::vector<opentl::core::cvdata::ColourHist2d> > > opentl::modalities::ColourHist2D::mColourHist2DMdetect`[static]`

Storage for reference color histogram (off-line, from SampleModelFeatures) One histogram per: target and patch The first index specifies the camera index, the second index specifies the targetid, 3rd index faceid.

std::vector<std::vector<std::vector<opentl::core::cvdata::ColourHist2d> > > opentl::modalities::ColourHist2D::mColourHist2DMtrack`[static]`

Storage for reference color histogram (on-line, from UpdateModelFeatures) One histogram per: target and patch The first index specifies the camera index, the second index specifies the targetid, 3rd index faceid.

std::vector<boost::shared_ptr<opentl::core::cvdata::Image> > opentl::modalities::ColourHist2D::mColourHist2DStaticDataImage`[static]`

std::vector<boost::shared_ptr<cvprocess::ColorHistShader> > opentl::modalities::ColourHist2D::mHistoShaders`[static]`

Shader for computing the color histogram on the GPU.

std::vector<boost::shared_ptr<cvprocess::ColorHistSum> > opentl::modalities::ColourHist2D::mHistoSumShaders`[static]`

Shader for summing up partial color histograms on the GPU.

std::vector<boost::shared_ptr<opentl::core::cvdata::TextureGpu> > opentl::modalities::ColourHist2D::mInputTextures`[static]`

Texture to copy the input image on the GPU.

std::vector<boost::shared_ptr<opentl::core::cvdata::TextureGpu> > opentl::modalities::ColourHist2D::mShadowTextures`[static]`

Texture for the object shadow (mask) GPU.