MRPT  2.0.4
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-2020, 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 
13 #include <mrpt/math/geometry.h>
14 #include <mrpt/poses/CPose3D.h>
16 #include <Eigen/Dense>
17 
18 namespace mrpt::vision
19 {
20 // State of the Lev-Marq optimization:
21 struct lm_stat_t
22 {
24  const std::vector<size_t>& valid_image_pair_indices;
25  const std::vector<mrpt::math::TPoint3D>& obj_points;
26 
27  // State being optimized:
28  // N*left_cam_pose + right2left_pose + left_cam_params + right_cam_params
29  // Poses of the origin of coordinates of the pattern wrt the left camera
30  std::vector<mrpt::math::TPose3D> left_cam_poses;
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  // Initial
45  left_cam_poses.assign(
46  images.size(), mrpt::math::TPose3D(0, 0, 1, 0, 0, 0));
47  }
48 
49  // Swap:
50  void swap(lm_stat_t& o)
51  {
53  std::swap(right2left_pose, o.right2left_pose);
54  std::swap(left_cam_params, o.left_cam_params);
55  std::swap(right_cam_params, o.right_cam_params);
56  }
57 };
58 
59 /** Data associated to *each observation* in the Lev-Marq. model */
61 {
62  /** [u_l v_l u_r v_r]: left/right camera pixels */
64  /** = predicted_obs - observations */
66  /** Jacobian. 4=the two predicted pixels; 30=Read below for the meaning of
67  * these 30 variables */
69 };
70 
72  std::vector<mrpt::aligned_std_vector<TResidJacobElement>>;
73 
74 // Auxiliary functions for the Lev-Marq algorithm:
76  const lm_stat_t& lm_stat, TResidualJacobianList& res_jac,
77  bool use_robust_kernel, double kernel_param);
79  const TResidualJacobianList& res_jac, const std::vector<size_t>& var_indxs,
81 void add_lm_increment(
83  const std::vector<size_t>& var_indxs, lm_stat_t& new_lm_stat);
84 } // namespace mrpt::vision
mrpt::vision::TResidualJacobianList
std::vector< mrpt::aligned_std_vector< TResidJacobElement > > TResidualJacobianList
Definition: chessboard_stereo_camera_calib_internal.h:72
mrpt::vision::recompute_errors_and_Jacobians
double recompute_errors_and_Jacobians(const lm_stat_t &lm_stat, TResidualJacobianList &res_jac, bool use_robust_kernel, double kernel_param)
Definition: chessboard_stereo_camera_calib.cpp:1053
Eigen::Matrix< double, 4, 1 >
geometry.h
mrpt::vision
Copyright (C) 2010 Hauke Strasdat Imperial College London Copyright (c) 2005-2020,...
Definition: bundle_adjustment.h:36
mrpt::vision::TResidJacobElement
Data associated to each observation in the Lev-Marq.
Definition: chessboard_stereo_camera_calib_internal.h:61
mrpt::vision::lm_stat_t::lm_stat_t
lm_stat_t(const TCalibrationStereoImageList &_images, const std::vector< size_t > &_valid_image_pair_indices, const std::vector< mrpt::math::TPoint3D > &_obj_points)
Definition: chessboard_stereo_camera_calib_internal.h:36
mrpt::vision::lm_stat_t::images
const TCalibrationStereoImageList & images
Definition: chessboard_stereo_camera_calib_internal.h:23
mrpt::vision::lm_stat_t
Definition: chessboard_stereo_camera_calib_internal.h:22
mrpt::vision::lm_stat_t::valid_image_pair_indices
const std::vector< size_t > & valid_image_pair_indices
Definition: chessboard_stereo_camera_calib_internal.h:24
chessboard_camera_calib.h
mrpt::vision::TResidJacobElement::predicted_obs
Eigen::Matrix< double, 4, 1 > predicted_obs
[u_l v_l u_r v_r]: left/right camera pixels
Definition: chessboard_stereo_camera_calib_internal.h:63
mrpt::vision::lm_stat_t::left_cam_poses
std::vector< mrpt::math::TPose3D > left_cam_poses
Definition: chessboard_stereo_camera_calib_internal.h:30
eps
const double eps
Definition: distributions_unittest.cpp:21
mrpt::vision::build_linear_system
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)
Definition: chessboard_stereo_camera_calib.cpp:754
mrpt::vision::lm_stat_t::right_cam_params
mrpt::math::CVectorFixedDouble< 9 > right_cam_params
Definition: chessboard_stereo_camera_calib_internal.h:33
mrpt::vision::lm_stat_t::obj_points
const std::vector< mrpt::math::TPoint3D > & obj_points
Definition: chessboard_stereo_camera_calib_internal.h:25
mrpt::math::CMatrixFixed
A compile-time fixed-size numeric matrix container.
Definition: CMatrixFixed.h:34
aligned_std_vector.h
mrpt::math::TPose3D
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
Definition: TPose3D.h:26
mrpt::vision::lm_stat_t::left_cam_params
mrpt::math::CVectorFixedDouble< 9 > left_cam_params
[fx fy cx cy k1 k2 k3 t1 t2]
Definition: chessboard_stereo_camera_calib_internal.h:33
mrpt::math::CVectorDynamic< double >
CPose3D.h
mrpt::vision::TCalibrationStereoImageList
std::vector< TImageStereoCalibData > TCalibrationStereoImageList
A list of images, used in checkerBoardStereoCalibration.
Definition: chessboard_stereo_camera_calib.h:137
mrpt::vision::TResidJacobElement::residual
Eigen::Matrix< double, 4, 1 > residual
= predicted_obs - observations
Definition: chessboard_stereo_camera_calib_internal.h:65
mrpt::vision::TResidJacobElement::J
Eigen::Matrix< double, 4, 30 > J
Jacobian.
Definition: chessboard_stereo_camera_calib_internal.h:68
mrpt::vision::lm_stat_t::swap
void swap(lm_stat_t &o)
Definition: chessboard_stereo_camera_calib_internal.h:50
mrpt::vision::add_lm_increment
void add_lm_increment(const mrpt::math::CVectorDynamic< double > &eps, const std::vector< size_t > &var_indxs, lm_stat_t &new_lm_stat)
Definition: chessboard_stereo_camera_calib.cpp:870
mrpt::math::CMatrixDynamic< double >
mrpt::vision::lm_stat_t::right2left_pose
mrpt::math::TPose3D right2left_pose
Definition: chessboard_stereo_camera_calib_internal.h:31



Page generated by Doxygen 1.8.18 for MRPT 2.0.4 at Thu Sep 24 07:14:18 UTC 2020