Struct Extrinsics
Defined in File Extrinsics.hpp
Struct Documentation
-
struct Extrinsics
Extrinsics structure.
Public Functions
-
Extrinsics() = default
-
Extrinsics(std::vector<std::vector<float>> rotationMatrix, Point3f translation, CameraBoardSocket toCameraSocket, LengthUnit lengthUnit = LengthUnit::CENTIMETER)
-
Extrinsics(const std::vector<std::vector<float>> &extrinsicsMatrix, CameraBoardSocket toCameraSocket, LengthUnit lengthUnit = LengthUnit::CENTIMETER)
-
Extrinsics(std::array<std::array<float, 4>, 4> &extrinsicsMatrix, CameraBoardSocket toCameraSocket, LengthUnit lengthUnit = LengthUnit::CENTIMETER)
-
std::vector<std::vector<float>> getRotationMatrix() const
Get the extrinsic rotation matrix in array format.
- Returns:
3x3 rotation matrix as a 2D array
-
std::vector<std::vector<float>> getInverseRotationMatrix() const
Get the inverse extrinsic rotation matrix in array format.
- Returns:
3x3 inverse rotation matrix as a 2D array
-
std::array<std::array<float, 4>, 4> getTransformationMatrix(bool useSpecTranslation = false, LengthUnit unit = LengthUnit::CENTIMETER) const
Get the Camera Extrinsics
object to the toCameraSocket.
The returned matrix has the following layout:
[ r00 r01 r02 Tx ] [ r10 r11 r12 Ty ] [ r20 r21 r22 Tz ] [ 0 0 0 1 ]
Note
The full transformation matrix can only be obtained if both the rotation matrix and the translation vector are set.
- Parameters:
useSpecTranslation – Set to true to force using spec translation
unit – Units of the returned translation vector
- Returns:
4x4 homogeneous transformation matrix
-
std::array<std::array<float, 4>, 4> getInverseTransformationMatrix(bool useSpecTranslation = false, LengthUnit unit = LengthUnit::CENTIMETER) const
Get the inverse of the extrinsic transformation matrix which is equal to the transformation from the toCameraSocket to the current camera socket.
- Parameters:
useSpecTranslation – Set to true to force using spec translation
unit – Units of the returned translation vector
- Returns:
a transformationMatrix which is 4x4 in homogeneous coordinate system
-
void setTransformationMatrix(const std::vector<std::vector<float>> &matrix, LengthUnit unit = LengthUnit::CENTIMETER)
Set the extrinsic transformation matrix.
The matrix must have the following layout:
[ r00 r01 r02 Tx ] [ r10 r11 r12 Ty ] [ r20 r21 r22 Tz ] [ 0 0 0 1 ]
- Parameters:
matrix – 4x4 homogeneous transformation matrix
unit – Units of the translation components Tx, Ty, and Tz
-
void setTransformationMatrix(const std::array<std::array<float, 4>, 4> &matrix, LengthUnit unit = LengthUnit::CENTIMETER)
Set the extrinsic transformation matrix.
The matrix must have the following layout:
[ r00 r01 r02 Tx ] [ r10 r11 r12 Ty ] [ r20 r21 r22 Tz ] [ 0 0 0 1 ]
- Parameters:
matrix – 4x4 homogeneous transformation matrix
unit – Units of the translation components Tx, Ty, and Tz
-
void setTranslationVector(const dai::Point3f &translationVector, LengthUnit unit = LengthUnit::CENTIMETER, bool useSpecTranslation = false)
Set the translation vector
- Parameters:
translationVector – The translation vector to set
unit – Units of the provided translation vector
useSpecTranslation – Set to true to force setting spec translation
-
std::vector<float> getTranslationVector(bool useSpecTranslation = false, LengthUnit unit = LengthUnit::CENTIMETER) const
Get the translation vector
- Parameters:
unit – Units of the returned translation vector
- Returns:
translation vector in specified units
-
bool isEqualExtrinsics(const Extrinsics &other, float epsilon = 1e-6f) const
Two Extrinsics objects are equal if their rotation matrices and translation vectors are equal (within a small epsilon).
- Parameters:
other – The other Extrinsics object to compare with
epsilon – The tolerance for comparing floating-point values
- Returns:
true if the Extrinsics objects are equal, false otherwise
-
std::array<std::array<float, 4>, 4> getExtrinsicsTransformationTo(const Extrinsics &to, bool useSpecTranslation = false, LengthUnit sourceUnit = LengthUnit::CENTIMETER) const
Get the extrinsic transformation matrix from this Extrinsics to the target Extrinsics.
- Parameters:
to – The target Extrinsics to get the transformation matrix to
useSpecTranslation – Set to true to force using spec translation
sourceUnit – Units of the translation vector in the source Extrinsics (this). Only relevant if useSpecTranslation is false.
- Returns:
a transformationMatrix which is 4x4 in homogeneous coordinate system
-
DEPTHAI_SERIALIZE_OPTIONAL(Extrinsics, rotationMatrix, translation, specTranslation, toCameraSocket, lengthUnit)
Public Members
-
std::vector<std::vector<float>> rotationMatrix
-
Point3f translation
(x, y, z) pose of destCameraSocket w.r.t currentCameraSocket obtained through calibration
-
Point3f specTranslation
(x, y, z) pose of destCameraSocket w.r.t currentCameraSocket measured through CAD design
-
CameraBoardSocket toCameraSocket = CameraBoardSocket::AUTO
The destination camera socket for which these extrinsics are defined.
-
LengthUnit lengthUnit = LengthUnit::CENTIMETER
The distance unit for the translation vector.
-
Extrinsics() = default