Galaxis Codebase  1.0.0
Team Galaxis software stack for the Carolo Cup 2023 - ROS2 based software
CameraCalibration.hpp
Go to the documentation of this file.
1 #ifndef CAMERA_CALIB_HPP
2 #define CAMERA_CALIB_HPP
3 
4 #include <opencv2/core/mat.hpp>
5 #include <opencv2/calib3d.hpp>
6 
7 
8 namespace galaxis {
9  namespace camera {
27  // mtx
28  cv::Mat const matrixD_mtx = (cv::Mat1d(3, 3) << 4.1762556576818139e+02, 0, 2.5803041199757405e+02, 0, 4.1789334832209283e+02, 8.3395313510144476e+01, 0, 0, 1);
29  // dist
30  cv::Mat const matrixK_dist = (cv::Mat1d(1, 5) << -4.1009180456714284e-01, 2.4282612421196481e-01, -5.4943175865065086e-03, 2.2892992455263131e-03, -1.0344846386273387e-01);
31 
32  // distort (inverse of undistortion)
33  // public PointF Distort(PointF point)
34  // {
35  // // To relative coordinates <- this is the step you are missing.
36  // double x = (point.X - cx) / fx;
37  // double y = (point.Y - cy) / fy;
38 
39  // double r2 = x*x + y*y;
40 
41  // // Radial distorsion
42  // double xDistort = x * (1 + k1 * r2 + k2 * r2 * r2 + k3 * r2 * r2 * r2);
43  // double yDistort = y * (1 + k1 * r2 + k2 * r2 * r2 + k3 * r2 * r2 * r2);
44 
45  // // Tangential distorsion
46  // xDistort = xDistort + (2 * p1 * x * y + p2 * (r2 + 2 * x * x));
47  // yDistort = yDistort + (p1 * (r2 + 2 * y * y) + 2 * p2 * x * y);
48 
49  // // Back to absolute coordinates.
50  // xDistort = xDistort * fx + cx;
51  // yDistort = yDistort * fy + cy;
52 
53  // return new PointF((float)xDistort, (float)yDistort);
54  // }
55 
56 
57 
58  cv::Mat getOptimalCameraMatrix();
59  cv::Mat getPerspectiveTransform();
60  } // namespace camera
61 
62 } // namespace galaxis
63 
64 #endif // CAMERA_CALIB_HPP
galaxis::camera::getPerspectiveTransform
cv::Mat getPerspectiveTransform()
Definition: CameraCalibration.cpp:11
galaxis::camera::matrixK_dist
const cv::Mat matrixK_dist
Definition: CameraCalibration.hpp:30
galaxis
Definition: MapClasses.hpp:10
galaxis::camera::matrixD_mtx
const cv::Mat matrixD_mtx
Definition: CameraCalibration.hpp:28
galaxis::camera::getOptimalCameraMatrix
cv::Mat getOptimalCameraMatrix()
Definition: CameraCalibration.cpp:6