FeatureMomentGravityCenterNormalized¶
- class FeatureMomentGravityCenterNormalized¶
Bases:
FeatureMoment
Functionality computation for centered and normalized moment feature. Computes the interaction matrix associated with vpMomentGravityCenterNormalized .
It computes the interaction matrices for \((x_n,y_n)\) . The interaction matrix for the moment feature has the following expression:
In the discrete case:
\[\begin{split}L_{x_n} = { \left[ \begin{array}{c} -Ax_{{n}}\theta+ \left( x_{{n}}e_{{1,1}}-y_{{n}} \right) B-a_{{n}}C \\\noalign{\medskip}Ax_{{n}}e_{{1,1}}+Bx_{{n}} \theta \\\noalign{\medskip} \left( -a_{{n}}-w_{{y}} \right) A+Bw_{{x}} \\\noalign{\medskip}a_{{n}}e_{{1,1}}{\it NA}+ \left( \eta_{{1,0}}e_{{1,1}}+\eta_{{0,1}}-e_{{2,1}}-x_{{g}}e_{{1,1}}+\eta_{{0,1}}\theta \right) x_{{n}}+ \left( \eta_{{1,0}}-x_{{g}}\theta \right) y_{{n}}-{\frac {x_{{n}}\eta_{{0,3}}}{{\it NA}}} \\\noalign{\medskip} \left( -1+\theta \right) a_{{n}}{\it NA}+ \left( e_{{1,2}}+x_{{g}}-\eta_{{0,1}}e_{{1,1}}-2\,\eta_{{1,0}}+e_{{3,0}}+ \left( -x_{{g}}+\eta_{{1,0}} \right) \theta \right) x_{{n}}+e_{{1,1}}x_{{g}}y_{{n}}-a_{{n}} \\\noalign{\medskip}y_{{n}} \end{array} \right] }^t \end{split}\]\[\begin{split}L_{y_n} = { \left[ \begin{array}{c} \left( 1-\theta \right) y_{{n}}A+y_{{n}}e_{{1,1}}B \\\noalign{\medskip} \left( -x_{{n}}+y_{{n}}e_{{1,1}} \right) A+ \left( -1+\theta \right) y_{{n}}B-a_{{n}}C \\\noalign{\medskip}-Aw_{{y}}+ \left( -a_{{n}}+w_{{x}} \right) B \\\noalign{\medskip}\theta\,a_{{n}}{\it NA}+ \left( -e_{{2,1}}+\eta_{{1,0}}e_{{1,1}}+\eta_{{0,1}}-x_{{g}}e_{{1,1}}+ \left( \eta_{{0,1}}-y_{{g}} \right) \theta \right) y_{{n}}+a_{{n}}-{\frac {y_{{n}}\eta_{{0,3}}}{{\it NA}}} \\\noalign{\medskip}-a_{{n}}e_{{1,1}}{\it NA}-x_{{n}}\eta_{{0,1}}+\left( e_{{1,2}}+y_{{g}}e_{{1,1}}-\eta_{{0,1}}e_{{1,1}}+x_{{g}}+e_{{3,0}}-2\,\eta_{{1,0}}+ \left( -x_{{g}}+\eta_{{1,0}} \right) \theta \right) y_{{n}} \\\noalign{\medskip}-x_{{n}} \end{array} \right] }^t \end{split}\]In the dense case:
\[\begin{split}L_{x_n} = { \left[ \begin {array}{c} -a_{{n}}C-1/2\,Ax_{{n}}-By_{{n}} \\\noalign{\medskip}1/2\,Bx_{{n}} \\\noalign{\medskip} \left( -a_{{n}}-w_{{y}} \right) A+Bw_{{x}} \\\noalign{\medskip} \left( 4\,\eta_{{1,0}}-1/2\,x_{{g}} \right) y_{{n}}+4\,a_{{n}}\eta_{{1,1}}+4\,x_{{n}}\eta_{{0,1}} \\\noalign{\medskip} \left( -4\,\eta_{{1,0}}+1/2\,x_{{g}} \right) x_{{n}}+ \left( -1-4\,\eta_{{2,0}} \right) a_{{n}} \\\noalign{\medskip}y_{{n}}\end {array} \right] }^t L_{y_n} = { \left[ \begin {array}{c} 1/2\,Ay_{{n}} \\\noalign{\medskip}-1/2\,By_{{n}}-a_{{n}}C-Ax_{{n}} \\\noalign{\medskip}-Aw_{{y}}+ \left( -a_{{n}}+w_{{x}} \right) B \\\noalign{\medskip}4\,\theta\,a_{{n}}{\it NA}+ \left( 4\,\eta_{{0,1}}-1/2\,y_{{g}} \right) y_{{n}}+a_{{n}} \\\noalign{\medskip} \left( -4\,\eta_{{1,0}}+1/2\,x_{{g}} \right) y_{{n}}-4\,a_{{n}}\eta_{{1,1}}-4\,x_{{n}}\eta_{{0,1}} \\\noalign{\medskip}-x_{{n}} \end {array} \right] }^t \end{split}\]
with:
\(e_{i,j}=\frac{\mu_{i,j}}{NA}\)
\(NA=\mu_{2,0}+\mu_{0,2}\)
\(\theta=\frac{\eta_{0,2}}{NA}\)
\(\eta\) is the centered and normalized moment.
These interaction matrices may be selected afterwards by calling vpFeatureMomentGravityCenterNormalized::interaction . The selection is done by the following methods: vpFeatureMomentGravityCenterNormalized::selectXn for \(L_{x_{n}}\) and vpFeatureMomentGravityCenterNormalized::selectYn for \(L_{y_{n}}\) . You can use these shortcut selectors as follows:
task.addFeature(db_src.getFeatureGravityNormalized(),db_dst.getFeatureGravityNormalized(), vpFeatureMomentGravityCenterNormalized::selectXn() | vpFeatureMomentGravityCenterNormalized::selectYn());
The behaviour of this feature is very similar to vpFeatureMomentGravityCenter which also contains a sample code demonstrating a selection.
This feature is often used in moment-based visual servoing to control the planar translation parameters.
Minimum vpMomentObject order needed to compute this feature: 2 in dense mode and 3 in discrete mode.
This feature depends on:
vpFeatureMomentGravityCenter
vpMomentGravityCenter
vpMomentAreaNormalized
vpFeatureMomentAreaNormalized
Methods
Overloaded function.
Associated moment name.
Feature name.
Shortcut selector for \(x_n\) .
Shortcut selector for \(y_n\) .
Inherited Methods
Updates the interaction matrices with the image plane the camera is facing.
Select all the features.
Overloaded function.
Indicates who should deallocate the feature.
Outputs the content of the feature: it's corresponding selected moments.
dim_s
user
Compute the error between two visual features from a subset of the possible features.
Set feature flags to true to prevent warning when re-computing the interaction matrix without having updated the feature.
Overloaded function.
Initialize common parameters for moment features.
s
nbParameters
Interface function to display the moments and other interaction matrices on which a particular vpFeatureMoment is dependent upon Not made pure to maintain compatibility Recommended : Types inheriting from vpFeatureMoment should implement this function.
Links the feature to the feature's database.
Get the feature vector \(\bf s\) .
Indicates who should deallocate the feature.
deallocate
Retrieves the interaction matrix.
vpServo
Return the dimension of the feature vector \(\bf s\) .
FEATURE_ALL
Operators
__doc__
__module__
Attributes
FEATURE_ALL
__annotations__
deallocate
dim_s
nbParameters
s
user
vpServo
- class BasicFeatureDeallocatorType(self, value: int)¶
Bases:
pybind11_object
Indicates who should deallocate the feature.
Values:
user
vpServo
- class BasicFeatureSelect(self, value: int)¶
Bases:
pybind11_object
Indicates who should deallocate the feature.
Values:
user
vpServo
- compute_interaction(*args, **kwargs)¶
Overloaded function.
compute_interaction(self: visp._visp.visual_features.FeatureMomentGravityCenterNormalized) -> None
Computes interaction matrix for centered and normalized moment. Called internally. The moment primitives must be computed before calling this. This feature depends on:
vpMomentCentered
vpMomentAreaNormalized
vpMomentGravityCenter
compute_interaction(self: visp._visp.visual_features.FeatureMoment) -> None
- display(*args, **kwargs)¶
Overloaded function.
display(self: visp._visp.visual_features.FeatureMoment, cam: visp._visp.core.CameraParameters, I: visp._visp.core.ImageGray, color: visp._visp.core.Color = vpColor::green, thickness: int = 1) -> None
Not implemented since visual representation of a moment doesn’t often make sense.
display(self: visp._visp.visual_features.FeatureMoment, cam: visp._visp.core.CameraParameters, I: visp._visp.core.ImageRGBa, color: visp._visp.core.Color = vpColor::green, thickness: int = 1) -> None
Not implemented since visual representation of a moment doesn’t often make sense.
-
error(self, s_star: visp.visual_features.BasicFeature, select: int =
FEATURE_ALL
) visp.core.ColVector ¶ Compute the error between two visual features from a subset of the possible features.
- getDeallocate(self) visp.visual_features.BasicFeature.BasicFeatureDeallocatorType ¶
- getDimension(*args, **kwargs)¶
Overloaded function.
getDimension(self: visp._visp.visual_features.FeatureMoment, select: int = FEATURE_ALL) -> int
Feature’s dimension according to selection.
getDimension(self: visp._visp.visual_features.BasicFeature, select: int = FEATURE_ALL) -> int
Get the feature vector dimension.
-
get_s(self, select: int =
FEATURE_ALL
) visp.core.ColVector ¶ Get the feature vector \(\bf s\) .
-
interaction(self, select: int =
FEATURE_ALL
) visp.core.Matrix ¶ Retrieves the interaction matrix. No computation is done.
There is no rule about the format of the feature selector. It may be different for different features. For example, for vpFeatureMomentBasic or vpFeatureMomentCentered features, select may refer to the \((i,j)\) couple in the \(j \times order + i\) format, but for vpFeatureMomentCInvariant the selector allows to select couples \((i,j,k,l...)\) in the following format: 1 << i
1 << j + 1 << k + 1 << l.
- linkTo(self, featureMoments: visp.visual_features.FeatureMomentDatabase) None ¶
Links the feature to the feature’s database.
Note
The feature’s database is different from the moment’s database.
- Parameters:
- featureMoments: visp.visual_features.FeatureMomentDatabase¶
database in which the moment features are stored.
-
print(self, select: int =
FEATURE_ALL
) None ¶ Outputs the content of the feature: it’s corresponding selected moments.
- printDependencies(self: visp._visp.visual_features.FeatureMoment, os: std::ostream) None ¶
Interface function to display the moments and other interaction matrices on which a particular vpFeatureMoment is dependent upon Not made pure to maintain compatibility Recommended : Types inheriting from vpFeatureMoment should implement this function.
- setDeallocate(self, d: visp.visual_features.BasicFeature.BasicFeatureDeallocatorType) None ¶
- setFlags(self) None ¶
Set feature flags to true to prevent warning when re-computing the interaction matrix without having updated the feature.
- update(self, A: float, B: float, C: float) None ¶
Updates the interaction matrices with the image plane the camera is facing. The plane must be in the format: \(\frac{1}{Z}=Ax+By+C\) . The moment primitives MUST be updated before calling this function.
This method also computes the interaction matrix. Therefore, you must call vpFeatureMoment::update before calling vpFeatureMoment::interaction .
Warning
The behaviour of this method is not the same as vpMoment::update which only acknowledges the new object. This method also computes the interaction matrices.