18 #ifndef VISION_COMMON_DISTORTER_H_
19 #define VISION_COMMON_DISTORTER_H_
23 #include <opencv2/opencv.hpp>
28 template <
int NUM_PARAMS,
typename DISTORTER>
31 Eigen::Vector2d
Distort(
const Eigen::VectorXd& distortion,
const Eigen::Matrix3d& intrinsics,
32 const Eigen::Vector2d& undistorted_point)
const {
33 return static_cast<DISTORTER const*
>(
this)->
Distort(distortion.data(), intrinsics, undistorted_point);
36 virtual Eigen::Vector2d
Undistort(
const Eigen::Vector2d& distorted_point,
const Eigen::Matrix3d& intrinsics,
37 const Eigen::VectorXd& distortion)
const = 0;
39 std::vector<Eigen::Vector2d>
Undistort(
const std::vector<Eigen::Vector2d>& distorted_points,
40 const Eigen::Matrix3d& intrinsics,
const Eigen::VectorXd& distortion)
const {
41 std::vector<Eigen::Vector2d> undistorted_points;
42 for (
const auto& distorted_point : distorted_points) {
43 undistorted_points.emplace_back(
Undistort(distorted_point, intrinsics, distortion));
45 return undistorted_points;
48 virtual cv::Mat
Undistort(
const cv::Mat& distorted_image,
const Eigen::Matrix3d& intrinsics,
49 const Eigen::VectorXd& distortion)
const = 0;
55 #endif // VISION_COMMON_DISTORTER_H_