Пример #1
0
/*!
  Track and compute the dot characteristics.

  To get the center of gravity coordinates of the dot, use
  getCog(). To compute the moments use setComputeMoments(true) before
  a call to initTracking().

  \warning The image is modified (all the pixels that belong to the point
  are set to white (ie to 255).

  \param I : Image to process.

  \sa getCog()
*/
void
vpDot::track(const vpImage<unsigned char> &I)
{
  try{
    setGrayLevelOut();
    double u = this->cog.get_u();
    double v = this->cog.get_v();

    COG( I, u, v ) ;

    this->cog.set_u( u );
    this->cog.set_v( v );
    
    if (compute_moment==true)
    {
      mu11 = m11 - u*m01;
      mu02 = m02 - v*m01;
      mu20 = m20 - u*m10;
    }

    if (graphics) {
      // display a red cross at the center of gravity's location in the image.
      vpDisplay::displayCross(I, this->cog, 3*thickness+8, vpColor::red, thickness);
    }

  }
  catch(...)
  {
    vpERROR_TRACE("Error caught") ;
    throw ;
  }
}
Пример #2
0
/*!
  Track and compute the dot characteristics.

  To get the center of gravity coordinates of the dot, use
  getCog(). To compute the moments use setComputeMoments(true) before
  a call to initTracking().

  \warning The image is modified (all the pixels that belong to the point
  are set to white (ie to 255).

  \param I : Image to process.

  \sa getCog()
*/
void
vpDot::track(vpImage<unsigned char> &I)
{
  try{
    setGrayLevelOut();
    double u = this->cog.get_u();
    double v = this->cog.get_v();

    COG( I, u, v ) ;

    this->cog.set_u( u );
    this->cog.set_v( v );
    
    if (compute_moment==true)
    {
      mu11 = m11 - u*m01;
      mu02 = m02 - v*m01;
      mu20 = m20 - u*m10;
    }
  }
  catch(...)
  {
    vpERROR_TRACE("Error caught") ;
    throw ;
  }
}