MomentGravityCenterNormalized

class MomentGravityCenterNormalized(self)

Bases: MomentGravityCenter

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)\) .

Default constructor.

Methods

__init__

Default constructor.

compute

Overloaded function.

name

Overloaded function.

printDependencies

Overloaded function.

Inherited Methods

linkTo

Links the moment to a database of moment primitives.

get

Overloaded function.

getObject

getXg

return:

The first gravity center coordinate.

update

Updates the moment with the current object.

getYg

return:

The second gravity center coordinate.

Operators

__doc__

__init__

Default constructor.

__module__

__repr__

Attributes

__annotations__

__init__(self)

Default constructor.

compute(*args, **kwargs)

Overloaded function.

  1. compute(self: visp._visp.core.MomentGravityCenterNormalized) -> None

Computes normalized gravity center moment. Depends on vpMomentAreaNormalized and on vpMomentGravityCenter .

  1. compute(self: visp._visp.core.MomentGravityCenter) -> None

Computes the two gravity center coordinates commonly called \(x_g\) and \(y_g\) .

get(*args, **kwargs)

Overloaded function.

  1. get(self: visp._visp.core.MomentGravityCenter) -> list[float]

Returns:

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

  1. get(self: visp._visp.core.Moment) -> list[float]

Returns:

vector of values

getObject(self) visp._visp.core.MomentObject
getXg(self) float
Returns:

The first gravity center coordinate.

getYg(self) float
Returns:

The second gravity center coordinate.

linkTo(self, moments: visp._visp.core.MomentDatabase) None

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.

Warning

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()
{
  vpPoint p;
  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)
  vec_p.push_back(p);

  vpMomentObject obj(2);
  obj.setType(vpMomentObject::DISCRETE); // Discrete mode.
  obj.fromVector(vec_p); // Init the dense object with the polygon

  vpMomentDatabase db;
  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;
}
name(*args, **kwargs)

Overloaded function.

  1. name(self: visp._visp.core.MomentGravityCenterNormalized) -> str

Moment name.

  1. name(self: visp._visp.core.MomentGravityCenter) -> str

The class’s string name.

printDependencies(*args, **kwargs)

Overloaded function.

  1. printDependencies(self: visp._visp.core.MomentGravityCenterNormalized, os: std::ostream) -> None

<unparsed orderedlist <doxmlparser.compound.docListType object at 0x7ff69ab228f0>>

  1. printDependencies(self: visp._visp.core.MomentGravityCenter, os: std::ostream) -> None

Prints its dependencies Basic moments m10, m01 and m00 from vpMomentObject

  1. printDependencies(self: visp._visp.core.Moment, os: std::ostream) -> None

Prints values of all dependent moments required to calculate a specific vpMoment . Not made pure to maintain compatibility Recommended : Types inheriting from vpMoment should implement this function

update(self, object: visp._visp.core.MomentObject) None

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