Visual Servoing Platform  version 3.5.1 under development (2023-09-22)
vpMomentGravityCenterNormalized Class Reference

#include <visp3/core/vpMomentGravityCenterNormalized.h>

+ Inheritance diagram for vpMomentGravityCenterNormalized:

Public Member Functions

 vpMomentGravityCenterNormalized ()
 
virtual ~vpMomentGravityCenterNormalized ()
 
void compute ()
 
const char * name () const
 
void printDependencies (std::ostream &os) const
 
Inherited functionalities from vpMomentGravityCenter
const std::vector< double > & get () const
 
double getXg () const
 
double getYg () const
 
Inherited functionalities from vpMoment
const vpMomentObjectgetObject () const
 
void linkTo (vpMomentDatabase &moments)
 
void update (vpMomentObject &object)
 

Protected Member Functions

vpMomentDatabasegetMoments () const
 

Protected Attributes

std::vector< double > values
 

Friends

VISP_EXPORT std::ostream & operator<< (std::ostream &os, const vpMomentGravityCenterNormalized &v)
 

Detailed Description

Class describing 2D normalized gravity center moment.

Centered and normalized gravity center moment is defined as follows: $(x_n,y_n)$ where $x_n = x_g a_n$ and $y_n = y_g a_n$.

vpMomentGravityCenterNormalized depends on vpMomentAreaNormalized to get access to $a_n$ and on vpMomentGravityCenter to get access to $(x_g,y_g)$ .

Examples
mbot-apriltag-ibvs.cpp, servoBebop2.cpp, and servoPixhawkDroneIBVS.cpp.

Definition at line 60 of file vpMomentGravityCenterNormalized.h.

Constructor & Destructor Documentation

◆ vpMomentGravityCenterNormalized()

vpMomentGravityCenterNormalized::vpMomentGravityCenterNormalized ( )

Default constructor.

Definition at line 74 of file vpMomentGravityCenterNormalized.cpp.

◆ ~vpMomentGravityCenterNormalized()

virtual vpMomentGravityCenterNormalized::~vpMomentGravityCenterNormalized ( )
inlinevirtual

Definition at line 64 of file vpMomentGravityCenterNormalized.h.

Member Function Documentation

◆ compute()

void vpMomentGravityCenterNormalized::compute ( )
virtual

◆ get()

const std::vector< double > & vpMomentGravityCenter::get ( ) const
inherited

Returns a vector of the two gravity center coordinates.

Returns
Coordinates in the following moment: $(x_g,y_g)$.

Definition at line 60 of file vpMomentGravityCenter.cpp.

References vpMoment::values.

Referenced by vpMomentCentered::compute(), compute(), vpFeatureMomentCentered::compute_interaction(), and printDependencies().

◆ getMoments()

◆ getObject()

◆ getXg()

◆ getYg()

◆ linkTo()

void vpMoment::linkTo ( vpMomentDatabase data_base)
inherited

Links the moment to a database of moment primitives. If the moment depends on other moments, these moments must be linked to the same database.

Attention
Two moments of the same class cannot be stored in the same database
#include <visp3/core/vpMomentCentered.h>
#include <visp3/core/vpMomentDatabase.h>
#include <visp3/core/vpMomentGravityCenter.h>
#include <visp3/core/vpMomentObject.h>
#include <visp3/core/vpPoint.h>
int main()
{
std::vector<vpPoint> vec_p;
p.set_x(1); p.set_y(1); // coordinates in meters in the image plane (vertex 1)
vec_p.push_back(p); p.set_x(2); p.set_y(2); // coordinates in meters in the image plane (vertex 2)
obj.setType(vpMomentObject::DISCRETE); // Discrete mode.
obj.fromVector(vec_p); // Init the dense object with the polygon
vpMomentGravityCenter G; // declaration of gravity center
vpMomentCentered mc; // mc contains centered moments
G.linkTo(db); //add gravity center to database
mc.linkTo(db); //centered moments depend on gravity, add them to the
//database to grant access
G.update(obj); // specify the object for gravity center
mc.update(obj); // and for centered moments
G.compute(); // compute the moment
mc.compute(); //compute centered moments AFTER gravity center
return 0;
}
This class defines the double-indexed centered moment descriptor .
This class allows to register all vpMoments so they can access each other according to their dependen...
Class describing 2D gravity center moment.
Class for generic objects.
void linkTo(vpMomentDatabase &moments)
Definition: vpMoment.cpp:98
void update(vpMomentObject &object)
Definition: vpMoment.cpp:115
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition: vpPoint.h:77
void set_x(double x)
Set the point x coordinate in the image plane.
Definition: vpPoint.cpp:508
void set_y(double y)
Set the point y coordinate in the image plane.
Definition: vpPoint.cpp:510
Parameters
data_base: database of moment primitives.
Examples
mbot-apriltag-ibvs.cpp, servoBebop2.cpp, servoPixhawkDroneIBVS.cpp, and testMomentAlpha.cpp.

Definition at line 98 of file vpMoment.cpp.

References vpException::memoryAllocationError, and vpMoment::name().

Referenced by vpMomentCommon::getAlpha(), vpMomentCommon::getMu3(), vpMomentCommon::getSurface(), and vpMomentCommon::vpMomentCommon().

◆ name()

const char* vpMomentGravityCenterNormalized::name ( ) const
inlinevirtual

Moment name.

Reimplemented from vpMomentGravityCenter.

Definition at line 67 of file vpMomentGravityCenterNormalized.h.

◆ printDependencies()

void vpMomentGravityCenterNormalized::printDependencies ( std::ostream &  os) const
virtual

Prints the dependent moments,

  1. centre of gravity
  2. normalized area moment

Reimplemented from vpMomentGravityCenter.

Definition at line 91 of file vpMomentGravityCenterNormalized.cpp.

References vpMoment::get(), vpMomentGravityCenter::get(), vpMomentDatabase::get(), vpMoment::getMoments(), and vpException::notInitialized.

◆ update()

void vpMoment::update ( vpMomentObject moment_object)
inherited

Updates the moment with the current object. This does not compute any values.

Parameters
moment_object: object descriptor of the current camera vision.

Definition at line 115 of file vpMoment.cpp.

Friends And Related Function Documentation

◆ operator<<

VISP_EXPORT std::ostream& operator<< ( std::ostream &  os,
const vpMomentGravityCenterNormalized v 
)
friend

Outputs the moment's values to a stream.

Definition at line 79 of file vpMomentGravityCenterNormalized.cpp.

Member Data Documentation

◆ values