Skip to content
Snippets Groups Projects

Resolve "Add method for vector rotation for converting to world coordinate system"

2 files
+ 25
24
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 6
5
@@ -897,14 +897,15 @@ cv::Point2f ExtrCalibration::getImagePoint(cv::Point3f p3d)
/**
* @brief Rotate a given vector from camera coordinate system to world coordinate system
*
* When the world coordinate system is not aligned to the camera-system,
*
* When the world coordinate system is not aligned to the camera-system,
* some direction dependent calculations (like head orientation) have to be rotated to be correctly exported.
*
*
* @param camVec the Vector to be rotated matching the camera coordinate system.
* @return the rotated vector.
*/
cv::Vec3d ExtrCalibration::camToWorldRotation(const cv::Vec3d camVec) {
cv::Vec3d ExtrCalibration::camToWorldRotation(const cv::Vec3d camVec)
{
// Transform the rotation vector into a rotation matrix with opencvs rodrigues method
cv::Matx<double, 3, 3> rot_mat(3, 3, CV_64F);
const cv::Mat rvec =
@@ -913,7 +914,7 @@ cv::Vec3d ExtrCalibration::camToWorldRotation(const cv::Vec3d camVec) {
mControlWidget->getCalibExtrRot3());
Rodrigues(rvec, rot_mat);
auto rot_inv = rot_mat.inv(cv::DECOMP_LU, nullptr);
auto rot_inv = rot_mat.inv(cv::DECOMP_LU, nullptr);
cv::Vec3d worldVec = rot_inv * camVec;
return worldVec;
}
Loading