26
#ifndef OPENCV_CORE_QUATERNION_HPP
27
#define OPENCV_CORE_QUATERNION_HPP
29
#include <opencv2/core.hpp>
30
#include <opencv2/core/utils/logger.hpp>
126
EULER_ANGLES_MAX_VALUE
132
template
<
typename
_Tp>
class
Quat;
133
template
<
typename
_Tp> std::ostream& operator<<(std::ostream&,
const
Quat<_Tp>&);
209
template
<
typename
_Tp>
212
static_assert(std::is_floating_point<_Tp>::value,
"Quaternion only make sense with type of float or double");
213
using
value_type = _Tp;
215
static
constexpr
_Tp CV_QUAT_EPS = (_Tp)1.e-6;
216
static
constexpr
_Tp CV_QUAT_CONVERT_THRESHOLD = (_Tp)1.e-6;
228
Quat(_Tp w, _Tp x, _Tp y, _Tp z);
312
_Tp
at(
size_t
index)
const;
333
template
<
typename
T>
362
template
<
typename
T>
403
template
<
typename
T>
441
template
<
typename
T>
478
template
<
typename
T>
513
template
<
typename
T>
560
template
<
typename
T>
592
template
<
typename
T>
620
template
<
typename
T>
648
template
<
typename
T>
676
template
<
typename
T>
704
template
<
typename
T>
731
template
<
typename
T>
758
template
<
typename
T>
786
template
<
typename
T>
814
template
<
typename
T>
841
template
<
typename
T>
867
template
<
typename
T>
893
template
<
typename
T>
1143
bool
directChange=
true);
1433
_Tp& operator[](std::size_t n);
1435
const
_Tp& operator[](std::size_t n)
const;
1449
template
<
typename
T>
1464
template
<
typename
T>
1479
template
<
typename
T>
1494
template
<
typename
T>
1519
template
<
typename
T>
1544
template
<
typename
T>
1547
template
<
typename
S>
1548
friend
std::ostream& cv::operator<<(std::ostream&,
const
Quat<S>&);
1622
template
<
typename
T>
1625
template
<
typename
T>
1628
template
<
typename
T>
1631
template
<
typename
T>
1634
template
<
typename
T>
1637
template
<
typename
T>
1640
template
<
typename
T>
1643
template
<
typename
T>
1646
template
<
typename
T>
1649
template
<
typename
T>
1652
template
<
typename
T>
1655
template
<
typename
T>
1658
template
<
typename
T>
1661
template
<
typename
T>
1664
template
<
typename
T>
1667
template
<
typename
T>
1670
template
<
typename
T>
1673
template
<
typename
T>
1676
template
<
typename
S>
1679
template
<
typename
T>
1682
template
<
typename
T>
1685
template
<
typename
S>
1686std::ostream& operator<<(std::ostream&,
const
Quat<S>&);
1694
#include "opencv2/core/quaternion.inl.hpp"
Template class for small matrices whose type and size are known at compilation time
Definition:
matx.hpp:100
Definition:
quaternion.hpp:56
EulerAnglesType
Enum of Euler angles type.
Definition:
quaternion.hpp:99
@ INT_XYZ
Intrinsic rotations with the Euler angles type X-Y-Z
Definition:
quaternion.hpp:100
@ EXT_YXZ
Extrinsic rotations with the Euler angles type Y-X-Z
Definition:
quaternion.hpp:115
@ INT_XZY
Intrinsic rotations with the Euler angles type X-Z-Y
Definition:
quaternion.hpp:101
@ EXT_YZX
Extrinsic rotations with the Euler angles type Y-Z-X
Definition:
quaternion.hpp:116
@ INT_XZX
Intrinsic rotations with the Euler angles type X-Z-X
Definition:
quaternion.hpp:107
@ INT_ZYZ
Intrinsic rotations with the Euler angles type Z-Y-Z
Definition:
quaternion.hpp:111
@ EXT_ZXY
Extrinsic rotations with the Euler angles type Z-X-Y
Definition:
quaternion.hpp:117
@ INT_YZY
Intrinsic rotations with the Euler angles type Y-Z-Y
Definition:
quaternion.hpp:109
@ INT_YXZ
Intrinsic rotations with the Euler angles type Y-X-Z
Definition:
quaternion.hpp:102
@ INT_XYX
Intrinsic rotations with the Euler angles type X-Y-X
Definition:
quaternion.hpp:106
@ EXT_YXY
Extrinsic rotations with the Euler angles type Y-X-Y
Definition:
quaternion.hpp:121
@ INT_ZXY
Intrinsic rotations with the Euler angles type Z-X-Y
Definition:
quaternion.hpp:104
@ EXT_ZXZ
Extrinsic rotations with the Euler angles type Z-X-Z
Definition:
quaternion.hpp:123
@ EXT_ZYX
Extrinsic rotations with the Euler angles type Z-Y-X
Definition:
quaternion.hpp:118
@ EXT_YZY
Extrinsic rotations with the Euler angles type Y-Z-Y
Definition:
quaternion.hpp:122
@ EXT_ZYZ
Extrinsic rotations with the Euler angles type Z-Y-Z
Definition:
quaternion.hpp:124
@ INT_ZXZ
Intrinsic rotations with the Euler angles type Z-X-Z
Definition:
quaternion.hpp:110
@ EXT_XZX
Extrinsic rotations with the Euler angles type X-Z-X
Definition:
quaternion.hpp:120
@ EXT_XYZ
Extrinsic rotations with the Euler angles type X-Y-Z
Definition:
quaternion.hpp:113
@ INT_ZYX
Intrinsic rotations with the Euler angles type Z-Y-X
Definition:
quaternion.hpp:105
@ INT_YZX
Intrinsic rotations with the Euler angles type Y-Z-X
Definition:
quaternion.hpp:103
@ EXT_XYX
Extrinsic rotations with the Euler angles type X-Y-X
Definition:
quaternion.hpp:119
@ EXT_XZY
Extrinsic rotations with the Euler angles type X-Z-Y
Definition:
quaternion.hpp:114
@ INT_YXY
Intrinsic rotations with the Euler angles type Y-X-Y
Definition:
quaternion.hpp:108
Definition:
quaternion.hpp:211
Quat< _Tp > cosh() const
return cosh value of this quaternion, cosh could be calculated as:
_Tp dot(Quat< _Tp > q) const
return the dot between quaternion and this quaternion.
static Quat< _Tp > createFromRvec(InputArray rvec)
from a rotation vector has the form , where represents rotation angle and represents normalized ro...
static Quat< _Tp > createFromZRot(const _Tp theta)
get a quaternion from a rotation about the Z-axis by .
friend Quat< T > cosh(const Quat< T > &q)
return cosh value of quaternion q, cosh could be calculated as:
static Quat< _Tp > createFromYRot(const _Tp theta)
get a quaternion from a rotation about the Y-axis by .
Quat< _Tp > conjugate() const
return the conjugate of this quaternion.
bool operator==(const Quat< _Tp > &) const
return true if two quaternions p and q are nearly equal, i.e. when the absolute value of each and i...
static Quat< _Tp > spline(const Quat< _Tp > &q0, const Quat< _Tp > &q1, const Quat< _Tp > &q2, const Quat< _Tp > &q3, const _Tp t, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
to calculate a quaternion which is the result of a continuous spline curve constructed by squad at t...
friend Quat< T > tanh(const Quat< T > &q)
return tanh value of quaternion q, tanh could be calculated as:
friend Quat< T > power(const Quat< T > &q, const T x, QuatAssumeType assumeUnit)
return the value of power function with index .
Quat< _Tp > operator*(const Quat< _Tp > &) const
Multiplication operator of two quaternions q and p. Multiplies values on either side of the operator.
Quat< _Tp > asinh() const
return arcsinh value of this quaternion, arcsinh could be calculated as:
Quat< _Tp > acosh() const
return arccosh value of this quaternion, arccosh could be calculated as:
static Quat< _Tp > createFromEulerAngles(const Vec< _Tp, 3 > &angles, QuatEnum::EulerAnglesType eulerAnglesType)
from Euler angles
static Quat< _Tp > createFromXRot(const _Tp theta)
get a quaternion from a rotation about the X-axis by .
_Tp getAngle(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
get the angle of quaternion, it returns the rotation angle.
Quat< _Tp > power(const Quat< _Tp > &q, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
return the value of power function with quaternion .
Vec< _Tp, 3 > getAxis(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
get the axis of quaternion, it returns a vector of length 3.
friend Quat< T > sin(const Quat< T > &q)
return tanh value of quaternion q, sin could be calculated as:
Quat< _Tp > exp() const
return the value of exponential value.
friend Quat< T > log(const Quat< T > &q, QuatAssumeType assumeUnit)
return the value of logarithm function.
static Quat< _Tp > createFromRotMat(InputArray R)
from a 3x3 rotation matrix.
Quat< _Tp > & operator/=(const Quat< _Tp > &)
Division assignment operator of two quaternions p and q; It divides left operand with the right opera...
Quat< _Tp > & operator*=(const _Tp s)
Multiplication assignment operator of a quaternions and a scalar. It multiplies right operand with th...
Matx< _Tp, 4, 4 > toRotMat4x4(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
transform a quaternion to a 4x4 rotation matrix.
Quat< _Tp > tan() const
return tan value of this quaternion, tan could be calculated as:
Quat< _Tp > sqrt(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
return .
Quat< _Tp > atan() const
return arctan value of this quaternion, arctan could be calculated as:
Quat< _Tp > operator-(const Quat< _Tp > &) const
Subtraction operator of two quaternions p and q. It returns a new quaternion that each value is the s...
Quat< _Tp > & operator-=(const Quat< _Tp > &)
Subtraction assignment operator of two quaternions p and q. It subtracts right operand from the left ...
Quat< _Tp > & operator*=(const Quat< _Tp > &)
Multiplication assignment operator of two quaternions q and p. It multiplies right operand with the l...
Quat< _Tp > sinh() const
return sinh value of this quaternion, sinh could be calculated as: where
bool isNormal(_Tp eps=CV_QUAT_EPS) const
return true if this quaternion is a unit quaternion.
Vec< _Tp, 3 > toEulerAngles(QuatEnum::EulerAnglesType eulerAnglesType)
Transform a quaternion q to Euler angles.
Vec< _Tp, 4 > toVec() const
transform the this quaternion to a Vec<T, 4>.
Quat< _Tp > crossProduct(const Quat< _Tp > &q) const
return the crossProduct between and .
Quat< _Tp > asin() const
return arcsin value of this quaternion, arcsin could be calculated as:
Quat< _Tp > & operator+=(const Quat< _Tp > &)
Addition assignment operator of two quaternions p and q. It adds right operand to the left operand an...
friend Quat< T > atanh(const Quat< T > &q)
return arctanh value of quaternion q, arctanh could be calculated as:
Quat< _Tp > normalize() const
return a normalized .
friend Quat< T > sinh(const Quat< T > &q)
return sinh value of quaternion q, sinh could be calculated as:
Quat< _Tp > power(const _Tp x, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
return the value of power function with index .
static Quat< _Tp > squad(const Quat< _Tp > &q0, const Quat< _Tp > &s0, const Quat< _Tp > &s1, const Quat< _Tp > &q1, const _Tp t, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT, bool directChange=true)
To calculate the interpolation between , , , by Spherical and quadrangle(Squad). This could be defin...
friend Quat< T > acosh(const Quat< T > &q)
return arccosh value of quaternion q, arccosh could be calculated as:
static Quat< _Tp > slerp(const Quat< _Tp > &q0, const Quat &q1, const _Tp t, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT, bool directChange=true)
To calculate the interpolation between and by Spherical Linear Interpolation(Slerp),...
friend Quat< T > atan(const Quat< T > &q)
return arctan value of quaternion q, arctan could be calculated as:
friend Quat< T > inv(const Quat< T > &q, QuatAssumeType assumeUnit)
return which is an inverse of which satisfies .
Quat< _Tp > acos() const
return arccos value of this quaternion, arccos could be calculated as:
static Quat< _Tp > nlerp(const Quat< _Tp > &q0, const Quat &q1, const _Tp t, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
To calculate the interpolation from to by Normalized Linear Interpolation(Nlerp)....
friend Quat< T > exp(const Quat< T > &q)
return the value of exponential value.
Quat< _Tp > cos() const
return cos value of this quaternion, cos could be calculated as:
Quat< _Tp > log(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
return the value of logarithm function.
Quat< _Tp > tanh() const
return tanh value of this quaternion, tanh could be calculated as:
Quat< _Tp > operator+(const Quat< _Tp > &) const
Addition operator of two quaternions p and q. It returns a new quaternion that each value is the sum ...
static Quat< _Tp > interPoint(const Quat< _Tp > &q0, const Quat< _Tp > &q1, const Quat< _Tp > &q2, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
This is the part calculation of squad. To calculate the intermedia quaternion between each three qua...
friend Quat< T > tan(const Quat< T > &q)
return tan value of quaternion q, tan could be calculated as:
static Quat< _Tp > lerp(const Quat< _Tp > &q0, const Quat &q1, const _Tp t)
To calculate the interpolation from to by Linear Interpolation(Nlerp) For two quaternions,...
_Tp norm() const
return the norm of quaternion.
void assertNormal(_Tp eps=CV_QUAT_EPS) const
to throw an error if this quaternion is not a unit quaternion.
Quat< _Tp > operator-() const
Return opposite quaternion which satisfies
Quat(_Tp w, _Tp x, _Tp y, _Tp z)
from four numbers.
Quat< _Tp > sin() const
return sin value of this quaternion, sin could be calculated as:
friend Quat< T > asinh(const Quat< T > &q)
return arcsinh value of quaternion q, arcsinh could be calculated as:
friend Quat< T > sqrt(const Quat< T > &q, QuatAssumeType assumeUnit)
return .
Quat(const Vec< _Tp, 4 > &coeff)
From Vec4d or Vec4f.
Quat< _Tp > inv(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
return which is an inverse of satisfying .
friend Quat< T > acos(const Quat< T > &q)
return arccos value of quaternion q, arccos could be calculated as:
Matx< _Tp, 3, 3 > toRotMat3x3(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
transform a quaternion to a 3x3 rotation matrix.
Quat< _Tp > & operator/=(const _Tp s)
Division assignment operator of a quaternions and a scalar. It divides left operand with the right op...
Quat< _Tp > atanh() const
return arctanh value of this quaternion, arctanh could be calculated as:
friend Quat< T > crossProduct(const Quat< T > &p, const Quat< T > &q)
return the crossProduct between and .
friend Quat< T > cos(const Quat< T > &q)
return sin value of quaternion q, cos could be calculated as:
Vec< _Tp, 3 > toRotVec(QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
transform this quaternion to a Rotation vector.
_Tp at(size_t index) const
a way to get element.
friend Quat< T > asin(const Quat< T > &q)
return arcsin value of quaternion q, arcsin could be calculated as:
friend Quat< T > power(const Quat< T > &p, const Quat< T > &q, QuatAssumeType assumeUnit)
return the value of power function with quaternion .
Quat< _Tp > operator/(const Quat< _Tp > &) const
Division operator of two quaternions p and q. Divides left hand operand by right hand operand.
static Quat< _Tp > createFromAngleAxis(const _Tp angle, const Vec< _Tp, 3 > &axis)
from an angle, axis. Axis will be normalized in this function. And it generates
Quat< _Tp > operator/(const _Tp s) const
Division operator of a quaternions and a scalar. It divides left operand with the right operand and a...
CV_EXPORTS_W void sqrt(InputArray src, OutputArray dst)
Calculates a square root of array elements.
CV_EXPORTS_W void exp(InputArray src, OutputArray dst)
Calculates the exponent of every array element.
CV_EXPORTS_W void log(InputArray src, OutputArray dst)
Calculates the natural logarithm of every array element.
Quat< T > tan(const Quat< T > &q)
Quat< T > asinh(const Quat< T > &q)
Quat< T > asin(const Quat< T > &q)
Quat< T > tanh(const Quat< T > &q)
Quat< T > crossProduct(const Quat< T > &p, const Quat< T > &q)
Quat< T > acosh(const Quat< T > &q)
Quat< T > atanh(const Quat< T > &q)
Quat< T > cos(const Quat< T > &q)
Quat< T > sinh(const Quat< T > &q)
QuatAssumeType
Unit quaternion flag
Definition:
quaternion.hpp:39
Quat< T > cosh(const Quat< T > &q)
Quat< T > atan(const Quat< T > &q)
Quat< T > sin(const Quat< T > &q)
Quat< T > acos(const Quat< T > &q)
@ QUAT_ASSUME_NOT_UNIT
Definition:
quaternion.hpp:46
@ QUAT_ASSUME_UNIT
Definition:
quaternion.hpp:52
"black box" representation of the file storage associated with a file on disk.
Definition:
aruco.hpp:75
DualQuat< T > inv(const DualQuat< T > &dq, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
Definition:
dualquaternion.inl.hpp:187
DualQuat< T > power(const DualQuat< T > &dq, const T t, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
Definition:
dualquaternion.inl.hpp:358