# opentl::models::Target Class Reference

Class representing a unique target instance It contains:

- the prior/posterior state distribution (pdf) in form of a Gaussian (mean and covariance matrix) or a particle set
- a pointer to the ObjModel
- the unique ID of this target instance.

More...

List of all members.

## Public Member Functions
virtual int | acquireId ()
| Acquire a new target id for this target instance. The id will be stored in the current target instance.
boost::shared_ptr < opentl::core::State > | activeState (std::size_t uPartition) const
| Get single state of the active states vector.
std::size_t | activeStateIdx (std::size_t uPartition) const
| Get index of single active state.
double | activeWeight (std::size_t uPartition) const
| Get weight of single state.
std::vector< double > & | activeWeightVec ()
| Get weight vector.
Target * | clone () const
| Create new instance of this class.
void | getGlobalROI (int camIdx, std::vector< int > &globalROI) const
| Get the region of interest (bounding box of all state hypotheses).
int | getTargetId () const
| Get the unique ID of this target.
std::size_t | nActiveStatePartitions () const
| Get number of partitions.
const std::string & | name () const
std::size_t | nofStates () const
| Get number of states in the distribution.
void | normalizeWeights ()
| Normalize weight vector (sum to 1.0).
const boost::shared_ptr < opentl::models::ObjModel > | objModel () const
| Get object model of this target.
Target & | operator= (const Target &target)
| Assignment operator: copy internal states and weights from another target (but NOT the ID!).
boost::shared_ptr < opentl::core::State > | outputState () const
| Get output state (average).
virtual void | releaseId ()
| Release a target id (should be called before the _real_ target (not the hypotheses of this target) are destroyed!
void | resizeActivePartitions (std::size_t nPartitions)
| resizes the number of partitions of the active states and the ActiveWeights vectors
void | resizeStateAuxVec (int size)
| Resize state distribution auxiliary vector.
void | resizeStateVec (int size)
| Resize state distribution vector.
void | setActiveStateIdx (std::size_t uPartition, std::size_t stateIdx)
| Set single state of the internal active State.
void | setActiveWeight (std::size_t uPartition, double weight)
| set weight of single state in active state set
void | setGlobalROI (int camIdx, std::vector< int > &globalROI)
| Set the region of interest (bounding box of all state hypotheses), pre-computed outside by the Warp class.
void | setName (const std::string &newName)
void | setOutputState (opentl::core::State &state)
| Set single state of the internal distribution.
void | setState (opentl::core::State &state, std::size_t i)
| Set single state of the internal distribution.
void | setStateAux (opentl::core::State &state, std::size_t i)
| Set single state of the internal auxiliary distribution.
void | setStateCov (const math::SquareMatrix &cov)
| Set internal state covariance.
void | setTargetId (int id)
| Set the unique ID of this target.
void | setWeight (std::size_t i, double weight)
| set weight of single state
boost::shared_ptr < opentl::core::State > | state (std::size_t i) const
| Get single state of the internal distribution.
boost::shared_ptr < opentl::core::State > | stateAux (std::size_t i) const
| Get single state of the internal auxiliary distribution.
std::vector< boost::shared_ptr < opentl::core::State > > * | stateAuxVec () const
| Get internal state auxiliary distribution.
math::SquareMatrix * | stateCov () const
| Get internal state covariance.
std::vector< boost::shared_ptr < opentl::core::State > > * | stateVec () const
| Get internal state distribution.
void | swapStateAndAuxVec ()
| Swap the internal vectors mStates and mStatesAux.
| Target (const Target &target)
| Copy constructor. Initialize object with existing target object.
| Target (const boost::shared_ptr< opentl::models::ObjModel > objModel, int nStates=1)
| Constructor.
double | weight (std::size_t i) const
| Get weight of single state.
std::vector< double > & | weightVec ()
| Get weight vector.
virtual | ~Target ()
| Destructor.
## Static Public Member Functions
static std::size_t | freeIdCount ()
| Get number of remaining free ids.
static std::size_t | maxNoTargets ()
| get maximum number of target ids
static std::size_t | noTargets ()
| get total number of currently active target ids

## Detailed Description

Class representing a unique target instance It contains:

- the prior/posterior state distribution (pdf) in form of a Gaussian (mean and covariance matrix) or a particle set
- a pointer to the ObjModel
- the unique ID of this target instance.

## Constructor & Destructor Documentation

opentl::models::Target::Target | ( | const boost::shared_ptr< opentl::models::ObjModel > | objModel,
|  | int | nStates = `1` |
| ) |  |  |

Constructor.

Parameters:

  | objModel | Object model related to this target (includes all information. and the State type)
  | stateTemplate | Template for building the state vector inside
  | nStates | (optional) Number of states of the distribution vector

opentl::models::Target::Target | ( | const Target & | target | ) |

Copy constructor. Initialize object with existing target object.

virtual opentl::models::Target::~Target | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

virtual int opentl::models::Target::acquireId | ( |  | ) | `[virtual]`

Acquire a new target id for this target instance. The id will be stored in the current target instance.

boost::shared_ptr<opentl::core::State> opentl::models::Target::activeState | ( | std::size_t | uPartition | ) | const`[inline]`

Get single state of the active states vector.

Parameters:

  | uPartition | position index

Returns:
  Pointer to single state.

std::size_t opentl::models::Target::activeStateIdx | ( | std::size_t | uPartition | ) | const`[inline]`

Get index of single active state.

Parameters:

  | uPartition | position index

Returns:
  Index of state.

double opentl::models::Target::activeWeight | ( | std::size_t | uPartition | ) | const`[inline]`

Get weight of single state.

Parameters:

  | uPartition | partition index for active states

Returns:
  weight value.

std::vector<double>& opentl::models::Target::activeWeightVec | ( |  | ) | `[inline]`

Get weight vector.

Returns:
  weight vector for all active states.

Target* opentl::models::Target::clone | ( |  | ) | const`[inline]`

Create new instance of this class.

static std::size_t opentl::models::Target::freeIdCount | ( |  | ) | `[static]`

Get number of remaining free ids.

void opentl::models::Target::getGlobalROI | ( | int | camIdx,
|  | std::vector< int > & | globalROI |
| ) |  |  | const

Get the region of interest (bounding box of all state hypotheses).

Parameters:

  | camIdx | Camera index
  | globalROI | Region of interest (x,y,width,height)

int opentl::models::Target::getTargetId | ( |  | ) | const`[inline]`

Get the unique ID of this target.

Returns:
  Target ID

static std::size_t opentl::models::Target::maxNoTargets | ( |  | ) | `[static]`

get maximum number of target ids

std::size_t opentl::models::Target::nActiveStatePartitions | ( |  | ) | const`[inline]`

Get number of partitions.

Returns:
  Number of partitions.

const std::string& opentl::models::Target::name | ( |  | ) | const`[inline]`

std::size_t opentl::models::Target::nofStates | ( |  | ) | const`[inline]`

Get number of states in the distribution.

Returns:
  Number of states.

void opentl::models::Target::normalizeWeights | ( |  | ) |

Normalize weight vector (sum to 1.0).

static std::size_t opentl::models::Target::noTargets | ( |  | ) | `[static]`

get total number of currently active target ids

const boost::shared_ptr<opentl::models::ObjModel> opentl::models::Target::objModel | ( |  | ) | const`[inline]`

Get object model of this target.

Returns:
  Pointer to ObjModel.

Target& opentl::models::Target::operator= | ( | const Target & | target | ) |

Assignment operator: copy internal states and weights from another target (but NOT the ID!).

boost::shared_ptr<opentl::core::State> opentl::models::Target::outputState | ( |  | ) | const`[inline]`

Get output state (average).

Returns:
  Pointer to output state.

virtual void opentl::models::Target::releaseId | ( |  | ) | `[virtual]`

Release a target id (should be called before the _real_ target (not the hypotheses of this target) are destroyed!

void opentl::models::Target::resizeActivePartitions | ( | std::size_t | nPartitions | ) | `[inline]`

resizes the number of partitions of the active states and the ActiveWeights vectors

Parameters:

  | nPartitions | partitions count

void opentl::models::Target::resizeStateAuxVec | ( | int | size | ) |

Resize state distribution auxiliary vector.

Parameters:

  | size | new size of the vector

void opentl::models::Target::resizeStateVec | ( | int | size | ) |

Resize state distribution vector.

Parameters:

  | size | new size of the vector

void opentl::models::Target::setActiveStateIdx | ( | std::size_t | uPartition,
|  | std::size_t | stateIdx |
| ) |  |  | `[inline]`

Set single state of the internal active State.

Parameters:

  | uPartition | set the value to state with index uPartition.
  | stateIdx | New state index.

void opentl::models::Target::setActiveWeight | ( | std::size_t | uPartition,
|  | double | weight |
| ) |  |  | `[inline]`

set weight of single state in active state set

Parameters:

  | uPartition | partition index
  | weight | value.

void opentl::models::Target::setGlobalROI | ( | int | camIdx,
|  | std::vector< int > & | globalROI |
| ) |  |  |

Set the region of interest (bounding box of all state hypotheses), pre-computed outside by the Warp class.

Parameters:

  | camIdx | Camera index
  | globalROI | Region of interest (x,y,width,height)

void opentl::models::Target::setName | ( | const std::string & | newName | ) | `[inline]`

void opentl::models::Target::setOutputState | ( | opentl::core::State & | state | ) | `[inline]`

Set single state of the internal distribution.

Parameters:

  | state | New state value.
  | i | set the value to state with index i.

void opentl::models::Target::setState | ( | opentl::core::State & | state,
|  | std::size_t | i |
| ) |  |  | `[inline]`

Set single state of the internal distribution.

Parameters:

  | state | New state value.
  | i | set the value to state with index i.

void opentl::models::Target::setStateAux | ( | opentl::core::State & | state,
|  | std::size_t | i |
| ) |  |  | `[inline]`

Set single state of the internal auxiliary distribution.

Parameters:

  | state | New state value.
  | i | set the value to state with index i.

void opentl::models::Target::setStateCov | ( | const math::SquareMatrix & | cov | ) | `[inline]`

Set internal state covariance.

Parameters:

  | cov | New covariance value.

void opentl::models::Target::setTargetId | ( | int | id | ) | `[inline]`

Set the unique ID of this target.

Returns:
  Target ID

void opentl::models::Target::setWeight | ( | std::size_t | i,
|  | double | weight |
| ) |  |  | `[inline]`

set weight of single state

Parameters:

  | i | Index inside the vector
  | weight | value.

boost::shared_ptr<opentl::core::State> opentl::models::Target::state | ( | std::size_t | i | ) | const`[inline]`

Get single state of the internal distribution.

Parameters:

  | i | position index

Returns:
  Pointer to single state.

boost::shared_ptr<opentl::core::State> opentl::models::Target::stateAux | ( | std::size_t | i | ) | const`[inline]`

Get single state of the internal auxiliary distribution.

Parameters:

  | i | position index

Returns:
  boost shared pointer to single state.

std::vector<boost::shared_ptr<opentl::core::State> >* opentl::models::Target::stateAuxVec | ( |  | ) | const`[inline]`

Get internal state auxiliary distribution.

Returns:
  Pointer to mStatesAux

math::SquareMatrix* opentl::models::Target::stateCov | ( |  | ) | const`[inline]`

Get internal state covariance.

Returns:
  Pointer to mStateCov.

std::vector<boost::shared_ptr<opentl::core::State> >* opentl::models::Target::stateVec | ( |  | ) | const`[inline]`

Get internal state distribution.

Returns:
  Pointer to mStates

void opentl::models::Target::swapStateAndAuxVec | ( |  | ) | `[inline]`

Swap the internal vectors mStates and mStatesAux.

double opentl::models::Target::weight | ( | std::size_t | i | ) | const`[inline]`

Get weight of single state.

Returns:
  Weight value.

std::vector<double>& opentl::models::Target::weightVec | ( |  | ) | `[inline]`

Get weight vector.

Returns:
  Weight vector.