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  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #include <mrpt/math/geometry.h>
13 #include <mrpt/poses/CPose3D.h>
15 #include <Eigen/Dense>
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
28  std::vector<mrpt::poses::CPose3D>
29  left_cam_poses; // Poses of the origin of coordinates of the pattern
30  // wrt the left camera
32  /** [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 */
63  /** = predicted_obs - observations */
65  /** Jacobian. 4=the two predicted pixels; 30=Read below for the meaning of
66  * these 30 variables */
68 };
69 
70 using TResidualJacobianList = std::vector<std::vector<TResidJacobElement>>;
71 
72 // Auxiliary functions for the Lev-Marq algorithm:
74  const lm_stat_t& lm_stat, TResidualJacobianList& res_jac,
75  bool use_robust_kernel, double kernel_param);
77  const TResidualJacobianList& res_jac, const std::vector<size_t>& var_indxs,
79 void add_lm_increment(
81  const std::vector<size_t>& var_indxs, lm_stat_t& new_lm_stat);
82 } // namespace mrpt::vision
A compile-time fixed-size numeric matrix container.
Definition: CMatrixFixed.h:33
std::vector< std::vector< TResidJacobElement > > TResidualJacobianList
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.
void add_lm_increment(const mrpt::math::CVectorDynamic< double > &eps, const std::vector< size_t > &var_indxs, lm_stat_t &new_lm_stat)
std::vector< mrpt::poses::CPose3D > left_cam_poses
const double eps
Classes for computer vision, detectors, features, etc.
Definition: CDifodo.h:17
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.
mrpt::math::CVectorFixedDouble< 9 > right_cam_params
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:84
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.
mrpt::math::CVectorFixedDouble< 9 > left_cam_params
[fx fy cx cy k1 k2 k3 t1 t2]
void build_linear_system(const TResidualJacobianList &res_jac, const std::vector< size_t > &var_indxs, mrpt::math::CVectorDynamic< double > &minus_g, mrpt::math::CMatrixDouble &H)



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019