Main MRPT website > C++ reference for MRPT 1.9.9
chessboard_stereo_camera_calib_internal.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #ifndef MRPT_VISION_INTERNAL_STEREO_CALIB_H
11 #define MRPT_VISION_INTERNAL_STEREO_CALIB_H
12 
14 #include <mrpt/poses/CPose3D.h>
15 #include <mrpt/math/geometry.h>
16 
17 namespace mrpt
18 {
19 namespace vision
20 {
21 // State of the Lev-Marq optimization:
22 struct lm_stat_t
23 {
25  const std::vector<size_t>& valid_image_pair_indices;
26  const std::vector<mrpt::math::TPoint3D>& obj_points;
27 
28  // State being optimized:
29  // N*left_cam_pose + right2left_pose + left_cam_params + right_cam_params
31  left_cam_poses; // Poses of the origin of coordinates of the pattern
32  // wrt the left camera
35  right_cam_params; // [fx fy cx cy k1 k2 k3 t1 t2]
36 
37  // Ctor
39  const TCalibrationStereoImageList& _images,
40  const std::vector<size_t>& _valid_image_pair_indices,
41  const std::vector<mrpt::math::TPoint3D>& _obj_points)
42  : images(_images),
43  valid_image_pair_indices(_valid_image_pair_indices),
44  obj_points(_obj_points)
45  {
46  left_cam_poses.assign(
47  images.size(), mrpt::poses::CPose3D(0, 0, 1, 0, 0, 0)); // Initial
48  }
49 
50  // Swap:
51  void swap(lm_stat_t& o)
52  {
54  std::swap(right2left_pose, o.right2left_pose);
55  std::swap(left_cam_params, o.left_cam_params);
56  std::swap(right_cam_params, o.right_cam_params);
57  }
58 };
59 
60 /** Data associated to *each observation* in the Lev-Marq. model */
62 {
63  /** [u_l v_l u_r v_r]: left/right camera pixels */
64  Eigen::Matrix<double, 4, 1> predicted_obs;
65  /** = predicted_obs - observations */
66  Eigen::Matrix<double, 4, 1> residual;
67  /** Jacobian. 4=the two predicted pixels; 30=Read below for the meaning of
68  * these 30 variables */
69  Eigen::Matrix<double, 4, 30> J;
70 };
71 
72 typedef std::vector<mrpt::aligned_containers<TResidJacobElement>::vector_t>
74 
75 // Auxiliary functions for the Lev-Marq algorithm:
77  const lm_stat_t& lm_stat, TResidualJacobianList& res_jac,
78  bool use_robust_kernel, double kernel_param);
80  const TResidualJacobianList& res_jac, const vector_size_t& var_indxs,
81  Eigen::VectorXd& minus_g, Eigen::MatrixXd& H);
82 void add_lm_increment(
83  const Eigen::VectorXd& eps, const vector_size_t& var_indxs,
84  lm_stat_t& new_lm_stat);
85 }
86 }
87 
88 #endif // MRPT_VISION_INTERNAL_STEREO_CALIB_H
std::vector< TImageStereoCalibData > TCalibrationStereoImageList
A list of images, used in checkerBoardStereoCalibration.
mrpt::aligned_containers< mrpt::poses::CPose3D >::vector_t left_cam_poses
Eigen::Matrix< double, 4, 1 > predicted_obs
[u_l v_l u_r v_r]: left/right camera pixels
const TCalibrationStereoImageList & images
Data associated to each observation in the Lev-Marq.
std::vector< mrpt::aligned_containers< TResidJacobElement >::vector_t > TResidualJacobianList
void build_linear_system(const TResidualJacobianList &res_jac, const vector_size_t &var_indxs, Eigen::VectorXd &minus_g, Eigen::MatrixXd &H)
const double eps
const std::vector< mrpt::math::TPoint3D > & obj_points
double recompute_errors_and_Jacobians(const lm_stat_t &lm_stat, TResidualJacobianList &res_jac, bool use_robust_kernel, double kernel_param)
const std::vector< size_t > & valid_image_pair_indices
Eigen::Matrix< double, 4, 1 > residual
= predicted_obs - observations
Eigen::Matrix< double, 4, 30 > J
Jacobian.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::math::CArrayDouble< 9 > right_cam_params
void add_lm_increment(const Eigen::VectorXd &eps, const vector_size_t &var_indxs, lm_stat_t &new_lm_stat)
mrpt::math::CArrayDouble< 9 > left_cam_params
std::vector< size_t > vector_size_t
Definition: types_simple.h:26
lm_stat_t(const TCalibrationStereoImageList &_images, const std::vector< size_t > &_valid_image_pair_indices, const std::vector< mrpt::math::TPoint3D > &_obj_points)
std::vector< TYPE1, Eigen::aligned_allocator< TYPE1 > > vector_t



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019