Main MRPT website > C++ reference for MRPT 1.5.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
30  mrpt::aligned_containers<mrpt::poses::CPose3D>::vector_t left_cam_poses; // Poses of the origin of coordinates of the pattern wrt the left camera
33 
34 
35  // Ctor
37  const TCalibrationStereoImageList & _images,
38  const std::vector<size_t> & _valid_image_pair_indices,
39  const std::vector<mrpt::math::TPoint3D> &_obj_points
40  ) : images(_images), valid_image_pair_indices(_valid_image_pair_indices), obj_points(_obj_points)
41  {
42  left_cam_poses.assign(images.size(), mrpt::poses::CPose3D(0,0,1, 0,0,0) ); // Initial
43  }
44 
45  // Swap:
46  void swap(lm_stat_t &o)
47  {
49  std::swap( right2left_pose, o.right2left_pose );
50  std::swap( left_cam_params, o.left_cam_params );
51  std::swap( right_cam_params, o.right_cam_params );
52  }
53  };
54 
55  /** Data associated to *each observation* in the Lev-Marq. model */
57  {
58  Eigen::Matrix<double,4,1> predicted_obs; //!< [u_l v_l u_r v_r]: left/right camera pixels
59  Eigen::Matrix<double,4,1> residual; //!< = predicted_obs - observations
60  Eigen::Matrix<double,4,30> J; //!< Jacobian. 4=the two predicted pixels; 30=Read below for the meaning of these 30 variables
61  };
62 
63  typedef std::vector< mrpt::aligned_containers<TResidJacobElement>::vector_t > TResidualJacobianList;
64 
65  // Auxiliary functions for the Lev-Marq algorithm:
66  double recompute_errors_and_Jacobians(const lm_stat_t & lm_stat, TResidualJacobianList &res_jac, bool use_robust_kernel, double kernel_param);
67  void build_linear_system(const TResidualJacobianList & res_jac, const vector_size_t & var_indxs, Eigen::VectorXd &minus_g, Eigen::MatrixXd &H);
68  void add_lm_increment(const Eigen::VectorXd &eps, const vector_size_t & var_indxs, lm_stat_t &new_lm_stat);
69 
70  }
71 }
72 
73 #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, 30 > J
Jacobian. 4=the two predicted pixels; 30=Read below for the meaning of these 30 variables.
const TCalibrationStereoImageList & images
Eigen::Matrix< double, 4, 1 > residual
= predicted_obs - observations
Data associated to each observation in the Lev-Marq.
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 > predicted_obs
[u_l v_l u_r v_r]: left/right camera pixels
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:72
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:25
std::vector< mrpt::aligned_containers< TResidJacobElement >::vector_t > TResidualJacobianList
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.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020