1 #ifndef __fovis_rectification_hpp__
2 #define __fovis_rectification_hpp__
8 #include "camera_intrinsics.hpp"
58 const Eigen::Matrix3d& rotation,
85 return _rectified_camera;
97 Eigen::Vector2d* rect_uv)
const
99 assert(dist_u >= 0 && dist_v >= 0 && dist_u < _input_camera.
width && dist_v < _input_camera.
height);
100 int pixel_index = dist_v * _input_camera.
width + dist_u;
101 rect_uv->x() = _map_x[pixel_index];
102 rect_uv->y() = _map_y[pixel_index];
115 Eigen::Vector2d* rect_uv)
const
117 rect_uv->x() = _map_x[pixel_index];
118 rect_uv->y() = _map_y[pixel_index];
129 Eigen::Vector2d* rect_uv)
const {
130 int u = (int)dist_uv.x();
131 int v = (int)dist_uv.y();
133 assert(u >= 0 && v >= 0 && u < _input_camera.
width && v < _input_camera.
height);
136 float wright = (dist_uv.x() - u);
137 float wbottom = (dist_uv.y() - v);
139 (1 - wright) * (1 - wbottom),
140 wright * (1 - wbottom),
141 (1 - wright) * wbottom,
145 int ra_index = v * _input_camera.
width + u;
146 int neighbor_indices[4] = {
149 ra_index + _input_camera.
width,
150 ra_index + _input_camera.
width + 1
155 for(
int i = 0; i < 4; ++i) {
156 rect_uv->x() += w[i] * _map_x[neighbor_indices[i]];
157 rect_uv->y() += w[i] * _map_y[neighbor_indices[i]];
171 CameraIntrinsicsParameters _input_camera;
173 Eigen::Matrix3d* _rotation;
176 CameraIntrinsicsParameters _rectified_camera;
int height
Definition: camera_intrinsics.hpp:49
const CameraIntrinsicsParameters & getInputCameraParameters() const
Definition: rectification.hpp:66
const Eigen::Matrix3d & getRectificationRotation() const
Definition: rectification.hpp:74
void rectifyLookup(int dist_u, int dist_v, Eigen::Vector2d *rect_uv) const
Definition: rectification.hpp:96
Maps image coordinates from an input image to image coordinates on a rectified camera.
Definition: rectification.hpp:41
quick and dirty profiling tool.inspired by the matlab tic/toc command
Definition: camera_intrinsics.hpp:6
int width
Definition: camera_intrinsics.hpp:44
Intrinsic parameters for a pinhole camera with plumb-bob distortion model.
Definition: camera_intrinsics.hpp:14
void rectifyLookupByIndex(int pixel_index, Eigen::Vector2d *rect_uv) const
Definition: rectification.hpp:114
Rectification * makeCopy() const
void rectifyBilinearLookup(const Eigen::Vector2d &dist_uv, Eigen::Vector2d *rect_uv) const
Definition: rectification.hpp:128
const CameraIntrinsicsParameters & getRectifiedCameraParameters() const
Definition: rectification.hpp:84