37#ifndef _vpMomentAreaNormalized_h_
38#define _vpMomentAreaNormalized_h_
40#include <visp3/core/vpMoment.h>
97 vpMomentObject obj(2); // Object where all the moment defined with
98 // i+j <= 2 will be computed below. Order is
99 // 2 because in discrete mode, the surface
100 // computation is a=mu02+mu02
103 obj.setType(vpMomentObject::DISCRETE); // Discrete mode for object
104 obj.fromVector(vec_p); // initialize the object with the points coordinates
106 vpMomentDatabase db; //reference database
107 vpMomentGravityCenter g; // declaration of gravity center
108 vpMomentCentered mc; // centered moments
109 vpMomentAreaNormalized an(2,1); //declare normalized surface with
110 //destination depth of 1 meter and
111 //destination surface of 2 m2
113 g.linkTo(db); //add gravity center to database
114 mc.linkTo(db); //add centered moments
115 an.linkTo(db); //add alpha depending on centered moments
117 db.updateAll(obj); // All of the moments must be updated, not just an
119 g.compute(); // compute the moment
120 mc.compute(); //compute centered moments AFTER gravity center
121 an.compute(); //compute alpha AFTER centered moments.
123 std::cout << an << std::endl;
128 This code produces the following output:
136 double desiredSurface;
164#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
180 const char *
name()
const {
return "vpMomentAreaNormalized"; }
Class handling the normalized surface moment that is invariant in scale and used to estimate depth.
virtual ~vpMomentAreaNormalized()
void setDesiredDepth(double Z_star)
double getDesiredArea() const
void setDesiredArea(double a_star)
double getDesiredDepth() const
const char * name() const
vpMomentAreaNormalized(double a_star, double Z_star)
vp_deprecated double getDesiredSurface() const
This class defines the double-indexed centered moment descriptor .
Class for generic objects.
friend VISP_EXPORT std::ostream & operator<<(std::ostream &os, const vpMoment &m)
virtual void printDependencies(std::ostream &os) const