![]() |
Visual Servoing Platform version 3.6.0
|
#include <vpMomentAlpha.h>
Inheritance diagram for vpMomentAlpha:Public Member Functions | |
| vpMomentAlpha () | |
| vpMomentAlpha (const std::vector< double > &mu3_ref, double alpha_ref, double threshold=1e-6) | |
| virtual | ~vpMomentAlpha () |
| void | compute () |
| double | get () const |
| const char * | name () const |
| bool | is_ref () const |
| bool | is_symmetric () const |
| void | printDependencies (std::ostream &os) const |
Inherited functionalities from vpMoment | |
| const vpMomentObject & | getObject () const |
| void | linkTo (vpMomentDatabase &moments) |
| void | update (vpMomentObject &object) |
Protected Member Functions | |
| vpMomentDatabase & | getMoments () const |
Protected Attributes | |
| std::vector< double > | values |
Friends | |
| VISP_EXPORT std::ostream & | operator<< (std::ostream &os, const vpMomentAlpha &v) |
This class defines the orientation of the object inside the plane parallel to the object.
In general the value of the moment is computed in ![$ [-\pi/2 ; \pi/2] $](form_228.png)

To obtain a ![$ [-\pi ; \pi] $](form_230.png)
![$ [-\pi/2 ; \pi/2] $](form_228.png)
Therefore there are two modes for vpMomentAlpha and one constructor per mode:
![$ [-\pi/2 ; \pi/2] $](form_228.png)
![$ [-\pi ; \pi] $](form_230.png)


The following code demonstrates a calculation of a reference alpha and then uses this alpha to estimate the orientation of the same object after performing a 180 degrees rotation. Therefore the first and second alpha should have opposite values.
This program outputs:
There is also testMomentAlpha.cpp example that shows how to compute alpha in the range ![$ [-\pi ; \pi] $](form_230.png)
From the first image we compute the 3rd order centered moments and the value of the reference alpha that is than used to compute the alpha moment in the range ![$ [-\pi ; \pi] $](form_230.png)
Shortcuts for quickly getting those references exist in vpMomentCommon.
This moment depends on vpMomentCentered.
Definition at line 202 of file vpMomentAlpha.h.
| vpMomentAlpha::vpMomentAlpha | ( | ) |
Empty constructor. Initializes alpha moment as a reference alpha with a value in ![$[-\pi/2 ; \pi/2]$](form_690.png)
![$[-\pi/2 ; \pi/2]$](form_690.png)
Definition at line 51 of file vpMomentAlpha.cpp.
References vpMoment::values.
| vpMomentAlpha::vpMomentAlpha | ( | const std::vector< double > & | mu3_ref, |
| double | alpha_ref, | ||
| double | threshold = 1e-6 |
||
| ) |
Common constructor. Initializes alpha moment as a non-reference alpha with a value computed in ![$[-\pi ; \pi]$](form_691.png)
| mu3_ref | : Vector of 3rd order centered moments corresponding to the reference alpha in the following order: ![]() |
| alpha_ref | : Value of the reference alpha that has mu3_ref 3rd order moments. |
| threshold | : Threshold used to determine object symmetry along its 2 axis. The object is declared symmetric if all the four 3rd order centered moments mu3_ref have values lower than this threshold. If the object is symmetric, the alpha angle is commuted in [ ![]() ![]() |
Definition at line 68 of file vpMomentAlpha.cpp.
References vpMoment::values.
|
inlinevirtual |
Definition at line 214 of file vpMomentAlpha.h.
|
virtual |
Compute the value of the alpha-moment. Depends on vpMomentCentered.
Implements vpMoment.
Definition at line 86 of file vpMomentAlpha.cpp.
References vpMath::comb(), vpMomentDatabase::get(), vpMomentCentered::get(), vpMoment::getMoments(), vpException::notInitialized, and vpMoment::values.
Referenced by vpMomentCommon::getAlpha(), and vpMomentCommon::updateAll().
|
inline |
Retrieve the orientation of the object as a single double value.
Definition at line 220 of file vpMomentAlpha.h.
Referenced by vpMomentCommon::getAlpha().
|
inlineprotectedinherited |
Returns the linked moment database.
Definition at line 118 of file vpMoment.h.
Referenced by compute(), vpMomentArea::compute(), vpMomentAreaNormalized::compute(), vpMomentCentered::compute(), vpMomentCInvariant::compute(), vpMomentGravityCenterNormalized::compute(), printDependencies(), vpMomentArea::printDependencies(), vpMomentAreaNormalized::printDependencies(), vpMomentCentered::printDependencies(), and vpMomentGravityCenterNormalized::printDependencies().
|
inlineinherited |
Definition at line 145 of file vpMoment.h.
Referenced by vpMomentArea::compute(), vpMomentAreaNormalized::compute(), vpMomentCentered::compute(), vpMomentCInvariant::compute(), vpMomentGravityCenter::compute(), vpFeatureMomentAlpha::compute_interaction(), vpFeatureMomentArea::compute_interaction(), vpFeatureMomentAreaNormalized::compute_interaction(), vpFeatureMomentBasic::compute_interaction(), vpFeatureMomentCentered::compute_interaction(), vpFeatureMomentCInvariant::compute_interaction(), vpFeatureMomentGravityCenter::compute_interaction(), vpFeatureMomentGravityCenterNormalized::compute_interaction(), vpMomentBasic::get(), vpMomentBasic::get(), vpMomentCentered::get(), vpFeatureMomentBasic::interaction(), vpFeatureMomentCentered::interaction(), vpMomentArea::printDependencies(), vpMomentAreaNormalized::printDependencies(), vpMomentBasic::printDependencies(), vpMomentCentered::printDependencies(), vpMomentGravityCenter::printDependencies(), vpMomentCentered::printWithIndices(), and vpMomentCentered::set().
|
inline |
Returns true if the alpha moment was constructed as a reference with values in ![$ [-\pi/2 ; \pi/2] $](form_228.png)
Definition at line 230 of file vpMomentAlpha.h.
|
inline |
Returns true if the alpha moment is computed on a symmetric object along its two axis. Symmetry is computed using 3rd order centered moments 
Definition at line 242 of file vpMomentAlpha.h.
|
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.
| data_base | : database of moment primitives. |
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().
|
inlinevirtual |
|
virtual |
Prints the dependencies of alpha, namely centered moments mu11, mu20 ad mu02
Reimplemented from vpMoment.
Definition at line 170 of file vpMomentAlpha.cpp.
References vpMomentDatabase::get(), vpMomentCentered::get(), vpMoment::getMoments(), and vpException::notInitialized.
|
inherited |
Updates the moment with the current object. This does not compute any values.
| moment_object | : object descriptor of the current camera vision. |
Definition at line 115 of file vpMoment.cpp.
|
friend |
Prints the value of the major-axis orientation in degrees and rad
Definition at line 160 of file vpMomentAlpha.cpp.
|
protectedinherited |
Definition at line 113 of file vpMoment.h.
Referenced by compute(), vpMomentArea::compute(), vpMomentAreaNormalized::compute(), vpMomentCentered::compute(), vpMomentCInvariant::compute(), vpMomentGravityCenter::compute(), vpMomentGravityCenterNormalized::compute(), vpMomentGravityCenter::get(), vpMomentCentered::get(), vpMomentCInvariant::getMomentVector(), vpMomentCentered::set(), vpMomentAlpha(), vpMomentAlpha(), vpMomentArea::vpMomentArea(), vpMomentAreaNormalized::vpMomentAreaNormalized(), vpMomentCInvariant::vpMomentCInvariant(), and vpMomentGravityCenter::vpMomentGravityCenter().