28struct InvertPolynomialIntrinsicsCostFunction {
30 typedef Vec2 FMatrixType;
31 typedef Vec2 XMatrixType;
33 InvertPolynomialIntrinsicsCostFunction(
const double focal_length_x,
34 const double focal_length_y,
35 const double principal_point_x,
36 const double principal_point_y,
44 : focal_length_x_(focal_length_x),
45 focal_length_y_(focal_length_y),
46 principal_point_x_(principal_point_x),
47 principal_point_y_(principal_point_y),
74 fx << (xx - x_), (yy - y_);
77 double focal_length_x_;
78 double focal_length_y_;
79 double principal_point_x_;
80 double principal_point_y_;
86struct InvertDivisionIntrinsicsCostFunction {
88 typedef Vec2 FMatrixType;
89 typedef Vec2 XMatrixType;
91 InvertDivisionIntrinsicsCostFunction(
const double focal_length_x,
92 const double focal_length_y,
93 const double principal_point_x,
94 const double principal_point_y,
99 : focal_length_x_(focal_length_x),
100 focal_length_y_(focal_length_y),
101 principal_point_x_(principal_point_x),
102 principal_point_y_(principal_point_y),
123 fx << (xx - x_), (yy - y_);
126 double focal_length_x_;
127 double focal_length_y_;
128 double principal_point_x_;
129 double principal_point_y_;
134struct InvertBrownIntrinsicsCostFunction {
136 typedef Vec2 FMatrixType;
137 typedef Vec2 XMatrixType;
139 InvertBrownIntrinsicsCostFunction(
const double focal_length_x,
140 const double focal_length_y,
141 const double principal_point_x,
142 const double principal_point_y,
149 const double image_x,
150 const double image_y)
151 : focal_length_x_(focal_length_x),
152 focal_length_y_(focal_length_y),
153 principal_point_x_(principal_point_x),
154 principal_point_y_(principal_point_y),
183 fx << (xx - x_), (yy - y_);
186 double focal_length_x_;
187 double focal_length_y_;
188 double principal_point_x_;
189 double principal_point_y_;
190 double k1_, k2_, k3_, k4_;
198 const double focal_length_y,
199 const double principal_point_x,
200 const double principal_point_y,
206 const double image_x,
207 const double image_y,
208 double* normalized_x,
209 double* normalized_y) {
213 normalized(0) = (image_x - principal_point_x) / focal_length_x;
214 normalized(1) = (image_y - principal_point_y) / focal_length_y;
218 InvertPolynomialIntrinsicsCostFunction intrinsics_cost(focal_length_x,
229 Solver::SolverParameters
params;
230 Solver solver(intrinsics_cost);
241 const double focal_length_y,
242 const double principal_point_x,
243 const double principal_point_y,
246 const double image_x,
247 const double image_y,
248 double* normalized_x,
249 double* normalized_y) {
253 normalized(0) = (image_x - principal_point_x) / focal_length_x;
254 normalized(1) = (image_y - principal_point_y) / focal_length_y;
259 InvertDivisionIntrinsicsCostFunction intrinsics_cost(focal_length_x,
267 Solver::SolverParameters
params;
268 Solver solver(intrinsics_cost);
279 const double focal_length_y,
280 const double principal_point_x,
281 const double principal_point_y,
288 const double image_x,
289 const double image_y,
290 double* normalized_x,
291 double* normalized_y) {
295 normalized(0) = (image_x - principal_point_x) / focal_length_x;
296 normalized(1) = (image_y - principal_point_y) / focal_length_y;
300 InvertBrownIntrinsicsCostFunction intrinsics_cost(focal_length_x,
312 Solver::SolverParameters
params;
313 Solver solver(intrinsics_cost);
329 const double focal_length_y,
330 const double principal_point_x,
331 const double principal_point_y,
336 const double expected_normalized_x,
337 const double expected_normalized_y)
350 double actual_normalized_x, actual_normalized_y;
362 &actual_normalized_x,
363 &actual_normalized_y);
381 const double focal_length_y,
382 const double principal_point_x,
383 const double principal_point_y,
388 const double normalized_x,
389 const double normalized_y,
395 image(0) = normalized_x * focal_length_x + principal_point_x;
396 image(1) = normalized_y * focal_length_y + principal_point_y;
411 Solver::SolverParameters
params;
412 Solver solver(intrinsics_cost);
414 solver.minimize(
params, &image);
static constexpr int image_width
static constexpr int image_height
SIMD_FORCE_INLINE btVector3 normalized() const
Return a normalized version of this vector.
void InvertNukeDistortionModel(const T &focal_length_x, const T &focal_length_y, const T &principal_point_x, const T &principal_point_y, const int image_width, const int image_height, const T &k1, const T &k2, const T &image_x, const T &image_y, T *normalized_x, T *normalized_y)
void InvertPolynomialDistortionModel(const double focal_length_x, const double focal_length_y, const double principal_point_x, const double principal_point_y, const double k1, const double k2, const double k3, const double p1, const double p2, const double image_x, const double image_y, double *normalized_x, double *normalized_y)
void ApplyPolynomialDistortionModel(const T &focal_length_x, const T &focal_length_y, const T &principal_point_x, const T &principal_point_y, const T &k1, const T &k2, const T &k3, const T &p1, const T &p2, const T &normalized_x, const T &normalized_y, T *image_x, T *image_y)
void ApplyDivisionDistortionModel(const T &focal_length_x, const T &focal_length_y, const T &principal_point_x, const T &principal_point_y, const T &k1, const T &k2, const T &normalized_x, const T &normalized_y, T *image_x, T *image_y)
void ApplyNukeDistortionModel(const double focal_length_x, const double focal_length_y, const double principal_point_x, const double principal_point_y, const int image_width, const int image_height, const double k1, const double k2, const double normalized_x, const double normalized_y, double *image_x, double *image_y)
void InvertBrownDistortionModel(const double focal_length_x, const double focal_length_y, const double principal_point_x, const double principal_point_y, const double k1, const double k2, const double k3, const double k4, const double p1, const double p2, const double image_x, const double image_y, double *normalized_x, double *normalized_y)
void InvertDivisionDistortionModel(const double focal_length_x, const double focal_length_y, const double principal_point_x, const double principal_point_y, const double k1, const double k2, const double image_x, const double image_y, double *normalized_x, double *normalized_y)
void ApplyBrownDistortionModel(const T &focal_length_x, const T &focal_length_y, const T &principal_point_x, const T &principal_point_y, const T &k1, const T &k2, const T &k3, const T &k4, const T &p1, const T &p2, const T &normalized_x, const T &normalized_y, T *image_x, T *image_y)
double expected_normalized_x_
double principal_point_y_
Vec2 operator()(const Vec2 &image_coordinate) const
double expected_normalized_y_
ApplyNukeIntrinsicsCostFunction(const double focal_length_x, const double focal_length_y, const double principal_point_x, const double principal_point_y, const int image_width, const int image_height, const double k1, const double k2, const double expected_normalized_x, const double expected_normalized_y)
double principal_point_x_