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-2018, 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::vision
18 {
19 // State of the Lev-Marq optimization:
20 struct lm_stat_t
21 {
23  const std::vector<size_t>& valid_image_pair_indices;
24  const std::vector<mrpt::math::TPoint3D>& obj_points;
25 
26  // State being optimized:
27  // N*left_cam_pose + right2left_pose + left_cam_params + right_cam_params
29  left_cam_poses; // Poses of the origin of coordinates of the pattern
30  // wrt the left camera
33  right_cam_params; // [fx fy cx cy k1 k2 k3 t1 t2]
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),
41  valid_image_pair_indices(_valid_image_pair_indices),
42  obj_points(_obj_points)
43  {
44  left_cam_poses.assign(
45  images.size(), mrpt::poses::CPose3D(0, 0, 1, 0, 0, 0)); // Initial
46  }
47 
48  // Swap:
49  void swap(lm_stat_t& o)
50  {
52  std::swap(right2left_pose, o.right2left_pose);
53  std::swap(left_cam_params, o.left_cam_params);
54  std::swap(right_cam_params, o.right_cam_params);
55  }
56 };
57 
58 /** Data associated to *each observation* in the Lev-Marq. model */
60 {
61  /** [u_l v_l u_r v_r]: left/right camera pixels */
62  Eigen::Matrix<double, 4, 1> predicted_obs;
63  /** = predicted_obs - observations */
64  Eigen::Matrix<double, 4, 1> residual;
65  /** Jacobian. 4=the two predicted pixels; 30=Read below for the meaning of
66  * these 30 variables */
67  Eigen::Matrix<double, 4, 30> J;
68 };
69 
71  std::vector<mrpt::aligned_std_vector<TResidJacobElement>>;
72 
73 // Auxiliary functions for the Lev-Marq algorithm:
75  const lm_stat_t& lm_stat, TResidualJacobianList& res_jac,
76  bool use_robust_kernel, double kernel_param);
78  const TResidualJacobianList& res_jac, const std::vector<size_t>& var_indxs,
79  Eigen::VectorXd& minus_g, Eigen::MatrixXd& H);
80 void add_lm_increment(
81  const Eigen::VectorXd& eps, const std::vector<size_t>& var_indxs,
82  lm_stat_t& new_lm_stat);
83 }
84 #endif // MRPT_VISION_INTERNAL_STEREO_CALIB_H
85 
86 
mrpt::aligned_std_vector< mrpt::poses::CPose3D > left_cam_poses
CArrayNumeric is an array for numeric types supporting several mathematical operations (actually...
Definition: CArrayNumeric.h:25
Eigen::Matrix< double, 4, 1 > predicted_obs
[u_l v_l u_r v_r]: left/right camera pixels
std::vector< T, mrpt::aligned_allocator_cpp11< T > > aligned_std_vector
const TCalibrationStereoImageList & images
Data associated to each observation in the Lev-Marq.
void build_linear_system(const TResidualJacobianList &res_jac, const std::vector< size_t > &var_indxs, Eigen::VectorXd &minus_g, Eigen::MatrixXd &H)
const double eps
Classes for computer vision, detectors, features, etc.
Definition: CCamModel.h:18
const std::vector< mrpt::math::TPoint3D > & obj_points
std::vector< mrpt::aligned_std_vector< TResidJacobElement > > TResidualJacobianList
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.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:86
mrpt::math::CArrayDouble< 9 > right_cam_params
mrpt::math::CArrayDouble< 9 > left_cam_params
void add_lm_increment(const Eigen::VectorXd &eps, const std::vector< size_t > &var_indxs, lm_stat_t &new_lm_stat)
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< TImageStereoCalibData > TCalibrationStereoImageList
A list of images, used in checkerBoardStereoCalibration.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020