MomentArea

class MomentArea(self)

Bases: Moment

Class handling the surface moment.

For a dense planar object, the area corresponds to the zero-order moment:

\[a = m_{00} = \mu_{00} \]

When considering a discrete set of points, the moment \(m_{00}\) simply corresponds to the number of points. Since this is of no use in a servoing scheme, this class uses in this case \(a = \mu_{20} + \mu_{02}\) , which is invariant to planar translation and rotation.

Default constructor.

Methods

__init__

Default constructor.

compute

Has the area \(a = m_{00} = \mu_{00}\) for dense objects, \(\mu_{20}+\mu_{02}\) for a discrete set of points.

name

Moment name.

printDependencies

Overloaded function.

Inherited Methods

linkTo

Links the moment to a database of moment primitives.

get

return:

vector of values

getObject

update

Updates the moment with the current object.

Operators

__doc__

__init__

Default constructor.

__module__

__repr__

Attributes

__annotations__

__init__(self)

Default constructor.

compute(self) None

Has the area \(a = m_{00} = \mu_{00}\) for dense objects, \(\mu_{20}+\mu_{02}\) for a discrete set of points. Gets the value of \(m_{00}\) from vpMomentCentered .

get(self) list[float]
Returns:

vector of values

getObject(self) visp._visp.core.MomentObject
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(self) str

Moment name.

printDependencies(*args, **kwargs)

Overloaded function.

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

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

  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.