VelocityTwistMatrix¶
- class VelocityTwistMatrix(*args, **kwargs)¶
Bases:
ArrayDouble2D
This class derived from vpArray2D<double> implements the 6 by 6 matrix which transforms velocities from one frame to another. This matrix is also called velocity twist transformation matrix.
The full velocity twist transformation matrix allows to compute the velocity at point a expressed in frame a knowing its velocity at point b expressed in frame b . This matrix is defined as:
\[\begin{split}^a{\bf V}_b = \left[\begin{array}{cc} ^a{\bf R}_b & [^a{\bf t}_b]_\times \; ^a{\bf R}_b\\{\bf 0}_{3\times 3} & ^a{\bf R}_b \end{array} \right] \end{split}\]where \(^a{\bf R}_b\) is a rotation matrix and \(^a{\bf t}_b\) is a translation vector.
There are different ways to initialize such a full velocity twist matrix. The following example shows how to proceed setting the translation and rotation matrix transformations:
#include <visp3/core/vpVelocityTwistMatrix.h> #ifdef ENABLE_VISP_NAMESPACE using namespace VISP_NAMESPACE_NAME; #endif int main() { vpTranslationVector cte(0.1, 0.2, 0.3); vpRotationMatrix cRe( {0, 0, -1, 0, -1, 0, -1, 0, 0} ); vpVelocityTwistMatrix cVe(cte, cRe); std::cout << "cVe:\n" << cVe << std::endl; }
It produces the following printings:
cVe: 0 0 -1 -0.2 0.3 0 0 -1 0 0.1 0 -0.3 -1 0 0 0 -0.1 0.2 0 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0
When the point where the velocity is expressed doesn’t change, the matrix becomes block diagonal. It allows than to compute the velocity at point b expressed in frame a knowing its velocity at point b expressed in frame b :
\[\begin{split}^a{\bf V}_b = \left[\begin{array}{cc} ^a{\bf R}_b & {\bf 0}_{3\times 3} \\{\bf 0}_{3\times 3} & ^a{\bf R}_b \end{array} \right] \end{split}\]To initialize such a velocity twist matrix where translation is not taken into account you can proceed like in the following code:
#include <visp3/core/vpVelocityTwistMatrix.h> #ifdef ENABLE_VISP_NAMESPACE using namespace VISP_NAMESPACE_NAME; #endif int main() { vpRotationMatrix cRe( {0, 0, -1, 0, -1, 0, -1, 0, 0} ); vpVelocityTwistMatrix cVe(cRe); std::cout << "cVe:\n" << cVe << std::endl; }
It produces the following printings:
cVe: 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0
The code below shows how to convert a velocity skew expressed at the origin of the camera frame into the origin of the fix frame using the full velocity twist matrix.
#include <visp3/core/vpColVector.h> #include <visp3/core/vpVelocityTwistMatrix.h> #ifdef ENABLE_VISP_NAMESPACE using namespace VISP_NAMESPACE_NAME; #endif int main() { vpVelocityTwistMatrix fVc; // Twist transformation matrix from fix to camera frame vpHomogeneousMatrix fMc; // Fix to camera frame transformation // ... fMc need here to be initialized fVc.buildFrom(fMc); vpColVector c_v(6); // Velocity in the camera frame: vx,vy,vz,wx,wy,wz // ... c_v should here have an initial value vpColVector f_v(6); // Velocity in the fix frame: vx,vy,vz,wx,wy,wz // Compute the velocity in the fix frame f_v = fVc * c_v; }
Overloaded function.
__init__(self: visp._visp.core.VelocityTwistMatrix) -> None
Initialize a velocity twist transformation matrix as identity.
__init__(self: visp._visp.core.VelocityTwistMatrix, V: visp._visp.core.VelocityTwistMatrix) -> None
Initialize a velocity twist transformation matrix from another velocity twist matrix.
- Parameters:
- V
Velocity twist matrix used as initializer.
__init__(self: visp._visp.core.VelocityTwistMatrix, M: visp._visp.core.HomogeneousMatrix, full: bool = true) -> None
__init__(self: visp._visp.core.VelocityTwistMatrix, t: visp._visp.core.TranslationVector, R: visp._visp.core.RotationMatrix) -> None
Initialize a velocity twist transformation matrix from a translation vector t and a rotation matrix R .
\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & [{\bf t}]_\times \; {\bf R} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- t
Translation vector.
- R
Rotation matrix.
__init__(self: visp._visp.core.VelocityTwistMatrix, t: visp._visp.core.TranslationVector, thetau: visp._visp.core.ThetaUVector) -> None
Initialize a velocity twist transformation matrix from a translation vector t and a rotation vector with \(\theta u\) parametrization.
\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & [{\bf t}]_\times \; {\bf R} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- t
Translation vector.
- thetau
math:theta u rotation vector used to initialize rotation vector \(R\) .
__init__(self: visp._visp.core.VelocityTwistMatrix, tx: float, ty: float, tz: float, tux: float, tuy: float, tuz: float) -> None
Initialize a velocity twist transformation matrix from a translation vector \({\bf t}=(t_x, t_y, t_z)^T\) and a rotation vector with \(\theta {\bf u}=(\theta u_x, \theta u_y, \theta u_z)^T\) parametrization.
\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & [{\bf t}]_\times \; {\bf R} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- tx
Translation vector in meters.
- ty
Translation vector in meters.
- tz
Translation vector in meters.
- tux
math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .
- tuy
math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .
- tuz
math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .
__init__(self: visp._visp.core.VelocityTwistMatrix, R: visp._visp.core.RotationMatrix) -> None
__init__(self: visp._visp.core.VelocityTwistMatrix, thetau: visp._visp.core.ThetaUVector) -> None
Methods
Overloaded function.
Overloaded function.
Overloaded function.
Initialize a 6x6 velocity twist matrix as identity.
Overloaded function.
Pretty print a velocity twist matrix.
Overloaded function.
Inherited Methods
Return the array max value.
- param m:
Second matrix;
Overloaded function.
Insert array B in array A at the given position.
Return the number of rows of the 2D array.
Overloaded function.
Overloaded function.
Numpy view of the underlying array data.
Save an array in a YAML-formatted file.
Return the array min value.
Return the number of columns of the 2D array.
Compute the transpose of the array.
Return the number of elements of the 2D array.
Operators
__doc__
Overloaded function.
__module__
Overloaded function.
Attributes
__annotations__
- __eq__(*args, **kwargs)¶
Overloaded function.
__eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
Equal to comparison operator of a 2D array.
__eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
Equal to comparison operator of a 2D array.
__eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
Equal to comparison operator of a 2D array.
- __getitem__(*args, **kwargs)¶
Overloaded function.
__getitem__(self: visp._visp.core.ArrayDouble2D, arg0: tuple[int, int]) -> float
__getitem__(self: visp._visp.core.ArrayDouble2D, arg0: int) -> numpy.ndarray[numpy.float64]
__getitem__(self: visp._visp.core.ArrayDouble2D, arg0: slice) -> numpy.ndarray[numpy.float64]
__getitem__(self: visp._visp.core.ArrayDouble2D, arg0: tuple) -> numpy.ndarray[numpy.float64]
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: visp._visp.core.VelocityTwistMatrix) -> None
Initialize a velocity twist transformation matrix as identity.
__init__(self: visp._visp.core.VelocityTwistMatrix, V: visp._visp.core.VelocityTwistMatrix) -> None
Initialize a velocity twist transformation matrix from another velocity twist matrix.
- Parameters:
- V
Velocity twist matrix used as initializer.
__init__(self: visp._visp.core.VelocityTwistMatrix, M: visp._visp.core.HomogeneousMatrix, full: bool = true) -> None
__init__(self: visp._visp.core.VelocityTwistMatrix, t: visp._visp.core.TranslationVector, R: visp._visp.core.RotationMatrix) -> None
Initialize a velocity twist transformation matrix from a translation vector t and a rotation matrix R .
\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & [{\bf t}]_\times \; {\bf R} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- t
Translation vector.
- R
Rotation matrix.
__init__(self: visp._visp.core.VelocityTwistMatrix, t: visp._visp.core.TranslationVector, thetau: visp._visp.core.ThetaUVector) -> None
Initialize a velocity twist transformation matrix from a translation vector t and a rotation vector with \(\theta u\) parametrization.
\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & [{\bf t}]_\times \; {\bf R} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- t
Translation vector.
- thetau
math:theta u rotation vector used to initialize rotation vector \(R\) .
__init__(self: visp._visp.core.VelocityTwistMatrix, tx: float, ty: float, tz: float, tux: float, tuy: float, tuz: float) -> None
Initialize a velocity twist transformation matrix from a translation vector \({\bf t}=(t_x, t_y, t_z)^T\) and a rotation vector with \(\theta {\bf u}=(\theta u_x, \theta u_y, \theta u_z)^T\) parametrization.
\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & [{\bf t}]_\times \; {\bf R} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- tx
Translation vector in meters.
- ty
Translation vector in meters.
- tz
Translation vector in meters.
- tux
math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .
- tuy
math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .
- tuz
math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .
__init__(self: visp._visp.core.VelocityTwistMatrix, R: visp._visp.core.RotationMatrix) -> None
__init__(self: visp._visp.core.VelocityTwistMatrix, thetau: visp._visp.core.ThetaUVector) -> None
- __mul__(*args, **kwargs)¶
Overloaded function.
__mul__(self: visp._visp.core.VelocityTwistMatrix, V: visp._visp.core.VelocityTwistMatrix) -> visp._visp.core.VelocityTwistMatrix
Operator that allows to multiply a velocity twist transformation matrix by an other velocity twist transformation matrix.
__mul__(self: visp._visp.core.VelocityTwistMatrix, M: visp._visp.core.Matrix) -> visp._visp.core.Matrix
Operator that allows to multiply a velocity twist transformation matrix by a matrix.
As shown in the example below, this operator can be used to compute the corresponding camera velocity skew from the joint velocities knowing the robot jacobian.
#include <visp3/core/vpColVector.h> #include <visp3/core/vpConfig.h> #include <visp3/core/vpVelocityTwistMatrix.h> #include <visp3/robot/vpSimulatorCamera.h> #ifdef ENABLE_VISP_NAMESPACE using namespace VISP_NAMESPACE_NAME; #endif int main() { vpSimulatorCamera robot; vpColVector q_vel(6); // Joint velocity on the 6 joints // ... q_vel need here to be initialized vpColVector c_v(6); // Velocity in the camera frame: vx,vy,vz,wx,wy,wz vpVelocityTwistMatrix cVe; // Velocity skew transformation from camera frame to end-effector robot.get_cVe(cVe); vpMatrix eJe; // Robot jacobian robot.get_eJe(eJe); // Compute the velocity in the camera frame c_v = cVe * eJe * q_vel; return 0; }
__mul__(self: visp._visp.core.VelocityTwistMatrix, v: visp._visp.core.ColVector) -> visp._visp.core.ColVector
Operator that allows to multiply a twist transformation matrix by a 6-dimension column vector.
- Parameters:
- v
Velocity skew vector.
- __ne__(*args, **kwargs)¶
Overloaded function.
__ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
Not equal to comparison operator of a 2D array.
__ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
Not equal to comparison operator of a 2D array.
__ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
Not equal to comparison operator of a 2D array.
- buildFrom(*args, **kwargs)¶
Overloaded function.
buildFrom(self: visp._visp.core.VelocityTwistMatrix, t: visp._visp.core.TranslationVector, R: visp._visp.core.RotationMatrix) -> visp._visp.core.VelocityTwistMatrix
Build a velocity twist transformation matrix from a translation vector t and a rotation matrix R .
\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & [{\bf t}]_\times \; {\bf R} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- t
Translation vector.
- R
Rotation matrix.
buildFrom(self: visp._visp.core.VelocityTwistMatrix, t: visp._visp.core.TranslationVector, thetau: visp._visp.core.ThetaUVector) -> visp._visp.core.VelocityTwistMatrix
Initialize a velocity twist transformation matrix from a translation vector t and a rotation vector with \(\theta u\) parametrization.
\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & [{\bf t}]_\times \; {\bf R} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- t
Translation vector.
- thetau
math:theta {bf u} rotation vector used to create rotation matrix \({\bf R}\) .
buildFrom(self: visp._visp.core.VelocityTwistMatrix, M: visp._visp.core.HomogeneousMatrix, full: bool = true) -> visp._visp.core.VelocityTwistMatrix
Initialize a velocity twist transformation matrix from an homogeneous matrix \(M\) with
\[\begin{split}{\bf M} = \left[\begin{array}{cc} {\bf R} & {\bf t} \\{\bf 0}_{1\times 3} & 1 \end{array} \right] \end{split}\]- Parameters:
- M
Homogeneous matrix \(M\) used to initialize the velocity twist transformation matrix.
- full
Boolean used to indicate which matrix should be filled.
When set to true, use the complete velocity skew transformation :
\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & [{\bf t}]_\times \; {\bf R} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]When set to false, use the block diagonal velocity skew transformation:
\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & {\bf 0}_{3\times 3} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right]\end{split}\]
buildFrom(self: visp._visp.core.VelocityTwistMatrix, R: visp._visp.core.RotationMatrix) -> visp._visp.core.VelocityTwistMatrix
Build a velocity twist transformation block diagonal matrix from a rotation matrix R.
\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & {\bf 0}_{3\times 3} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- R
Rotation matrix.
buildFrom(self: visp._visp.core.VelocityTwistMatrix, thetau: visp._visp.core.ThetaUVector) -> visp._visp.core.VelocityTwistMatrix
Initialize a velocity twist transformation matrix from a rotation vector with \(\theta u\) parametrization.
\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & {\bf 0}_{3\times 3} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- thetau
math:theta {bf u} rotation vector used to create rotation matrix \({\bf R}\) .
- static conv2(*args, **kwargs)¶
Overloaded function.
conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, mode: str) -> visp._visp.core.ArrayDouble2D
Perform a 2D convolution similar to Matlab conv2 function: \(M \star kernel\) .
<unparsed image <doxmlparser.compound.docImageType object at 0x7f122fb6a440>>
Note
This is a very basic implementation that does not use FFT.
- Parameters:
- M
First matrix.
- kernel
Second matrix.
- mode
Convolution mode: “full” (default), “same”, “valid”.
conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, res: visp._visp.core.ArrayDouble2D, mode: str) -> None
Perform a 2D convolution similar to Matlab conv2 function: \(M \star kernel\) .
<unparsed image <doxmlparser.compound.docImageType object at 0x7f122fb8c0a0>>
Note
This is a very basic implementation that does not use FFT.
- Parameters:
- M
First array.
- kernel
Second array.
- res
Result.
- mode
Convolution mode: “full” (default), “same”, “valid”.
conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, mode: str) -> visp._visp.core.ArrayDouble2D
Perform a 2D convolution similar to Matlab conv2 function: \(M \star kernel\) .
<unparsed image <doxmlparser.compound.docImageType object at 0x7f122fb6a440>>
Note
This is a very basic implementation that does not use FFT.
- Parameters:
- M
First matrix.
- kernel
Second matrix.
- mode
Convolution mode: “full” (default), “same”, “valid”.
conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, res: visp._visp.core.ArrayDouble2D, mode: str) -> None
Perform a 2D convolution similar to Matlab conv2 function: \(M \star kernel\) .
<unparsed image <doxmlparser.compound.docImageType object at 0x7f122fb8c0a0>>
Note
This is a very basic implementation that does not use FFT.
- Parameters:
- M
First array.
- kernel
Second array.
- res
Result.
- mode
Convolution mode: “full” (default), “same”, “valid”.
- extract(*args, **kwargs)¶
Overloaded function.
extract(self: visp._visp.core.VelocityTwistMatrix, R: visp._visp.core.RotationMatrix) -> None
Extract the rotation matrix from the velocity twist matrix.
extract(self: visp._visp.core.VelocityTwistMatrix, t: visp._visp.core.TranslationVector) -> None
Extract the translation vector from the velocity twist matrix.
- hadamard(self, m: visp._visp.core.ArrayDouble2D) visp._visp.core.ArrayDouble2D ¶
- Parameters:
- m: visp._visp.core.ArrayDouble2D¶
Second matrix;
- Returns:
m1.hadamard(m2) The Hadamard product : \(m1 \circ m2 = (m1 \circ m2)_{i,j} = (m1)_{i,j} (m2)_{i,j}\)
- insert(*args, **kwargs)¶
Overloaded function.
insert(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D, r: int, c: int) -> None
Insert array A at the given position in the current array.
Warning
Throw vpException::dimensionError if the dimensions of the matrices do not allow the operation.
- Parameters:
- A
The array to insert.
- r
The index of the row to begin to insert data.
- c
The index of the column to begin to insert data.
insert(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D, B: visp._visp.core.ArrayDouble2D, r: int, c: int) -> visp._visp.core.ArrayDouble2D
Insert array B in array A at the given position.
Warning
Throw exception if the sizes of the arrays do not allow the insertion.
- Parameters:
- A
Main array.
- B
Array to insert.
- r
Index of the row where to add the array.
- c
Index of the column where to add the array.
- Returns:
Array with B insert in A.
- static insertStatic(A: visp._visp.core.ArrayDouble2D, B: visp._visp.core.ArrayDouble2D, C: visp._visp.core.ArrayDouble2D, r: int, c: int) None ¶
Insert array B in array A at the given position.
Warning
Throw exception if the sizes of the arrays do not allow the insertion.
- Parameters:
- A: visp._visp.core.ArrayDouble2D¶
Main array.
- B: visp._visp.core.ArrayDouble2D¶
Array to insert.
- C: visp._visp.core.ArrayDouble2D¶
Result array.
- r: int¶
Index of the row where to insert array B.
- c: int¶
Index of the column where to insert array B.
- inverse(*args, **kwargs)¶
Overloaded function.
inverse(self: visp._visp.core.VelocityTwistMatrix) -> visp._visp.core.VelocityTwistMatrix
Invert the velocity twist matrix.
inverse(self: visp._visp.core.VelocityTwistMatrix, V: visp._visp.core.VelocityTwistMatrix) -> None
Invert the velocity twist matrix.
- numpy(self) numpy.ndarray[numpy.float64] ¶
Numpy view of the underlying array data. This numpy view can be used to directly modify the array.
- print(self: visp._visp.core.VelocityTwistMatrix, s: std::ostream, length: int, intro: str = 0) int ¶
Pretty print a velocity twist matrix. The data are tabulated. The common widths before and after the decimal point are set with respect to the parameter maxlen.
Note
See std::ostream & operator<<(std::ostream &s, const vpArray2D<Type> &A)
- Parameters:
- s
Stream used for the printing.
- length
The suggested width of each matrix element. The actual width grows in order to accommodate the whole integral part, and shrinks if the whole extent is not needed for all the numbers.
- intro
The introduction which is printed before the matrix. Can be set to zero (or omitted), in which case the introduction is not printed.
- Returns:
Returns the common total width for all matrix elements
- resize(*args, **kwargs)¶
Overloaded function.
resize(self: visp._visp.core.VelocityTwistMatrix, nrows: int, ncols: int, flagNullify: bool = true) -> None
This function is not applicable to a velocity twist matrix that is always a 6-by-6 matrix.
resize(self: visp._visp.core.ArrayDouble2D, nrows: int, ncols: int, flagNullify: bool = true, recopy_: bool = true) -> None
Set the size of the array and initialize all the values to zero.
- Parameters:
- nrows
number of rows.
- ncols
number of column.
- flagNullify
if true, then the array is re-initialized to 0 after resize. If false, the initial values from the common part of the array (common part between old and new version of the array) are kept. Default value is true.
- recopy_
if true, will perform an explicit recopy of the old data.
- static save(*args, **kwargs)¶
Overloaded function.
save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool
Save a matrix to a file.
Warning : If you save the matrix as in a text file the precision is less than if you save it in a binary file.
Note
See load()
- Parameters:
- filename
Absolute file name.
- A
Array to be saved.
- binary
If true the matrix is saved in a binary file, else a text file.
- header
Optional line that will be saved at the beginning of the file.
- Returns:
Returns true if success.
save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool
Save a matrix to a file.
Warning : If you save the matrix as in a text file the precision is less than if you save it in a binary file.
Note
See load()
- Parameters:
- filename
Absolute file name.
- A
Array to be saved.
- binary
If true the matrix is saved in a binary file, else a text file.
- header
Optional line that will be saved at the beginning of the file.
- Returns:
Returns true if success.
save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool
Save a matrix to a file.
Warning : If you save the matrix as in a text file the precision is less than if you save it in a binary file.
Note
See load()
- Parameters:
- filename
Absolute file name.
- A
Array to be saved.
- binary
If true the matrix is saved in a binary file, else a text file.
- header
Optional line that will be saved at the beginning of the file.
- Returns:
Returns true if success.
- static saveYAML(filename: str, A: visp._visp.core.ArrayDouble2D, header: str =) bool ¶
Save an array in a YAML-formatted file.
Here is an example of outputs.
vpArray2D<double> M(3,4); vpArray2D::saveYAML("matrix.yml", M, "example: a YAML-formatted header"); vpArray2D::saveYAML("matrixIndent.yml", M, "example:\n - a YAML-formatted \ header\n - with inner indentation");
Content of matrix.yml:
example: a YAML-formatted header rows: 3 cols: 4 data: - [0, 0, 0, 0] - [0, 0, 0, 0] - [0, 0, 0, 0]
Content of matrixIndent.yml:
example: - a YAML-formatted header - with inner indentation rows: 3 cols: 4 data: - [0, 0, 0, 0] - [0, 0, 0, 0] - [0, 0, 0, 0]
Note
See loadYAML()
- Parameters:
- filename
absolute file name.
- A
array to be saved in the file.
- header
optional lines that will be saved at the beginning of the file. Should be YAML-formatted and will adapt to the indentation if any.
- Returns:
Returns true if success.
- t(self) visp._visp.core.ArrayDouble2D ¶
Compute the transpose of the array.
- Returns:
vpArray2D<Type> C = A^T
-
__hash__ =
None
¶