OKVIS ROS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RadialTangentialDistortion8.hpp
Go to the documentation of this file.
1 /*********************************************************************************
2  * OKVIS - Open Keyframe-based Visual-Inertial SLAM
3  * Copyright (c) 2015, Autonomous Systems Lab / ETH Zurich
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * * Neither the name of Autonomous Systems Lab / ETH Zurich nor the names of
14  * its contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  *
29  * Created on: Jul 28, 2015
30  * Author: Stefan Leutenegger (s.leutenegger@imperial.ac.uk)
31  *********************************************************************************/
32 
39 #ifndef INCLUDE_OKVIS_CAMERAS_RADIALTANGENTIALDISTORTION8_HPP_
40 #define INCLUDE_OKVIS_CAMERAS_RADIALTANGENTIALDISTORTION8_HPP_
41 
42 #include <memory>
43 #include <Eigen/Core>
45 
47 namespace okvis {
49 namespace cameras {
50 
52 {
53  public:
54  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
55 
58 
68  inline RadialTangentialDistortion8(double k1, double k2, double p1, double p2,
69  double k3, double k4, double k5,
70  double k6);
71 
75 
79  inline bool setParameters(const Eigen::VectorXd & parameters);
80 
82  inline bool getParameters(Eigen::VectorXd & parameters) const
83  {
84  parameters = parameters_;
85  return true;
86  }
87 
89  inline std::string type() const
90  {
91  return "RadialTangentialDistortion8";
92  }
93 
95  inline int numDistortionIntrinsics() const
96  {
98  }
99 
100  static const int NumDistortionIntrinsics = 8;
101 
104  static std::shared_ptr<DistortionBase> createTestObject()
105  {
106  return std::shared_ptr<DistortionBase>(
107  new RadialTangentialDistortion8(0.6261, 0.001, -0.0002, 0.0001, 0.0001,
108  0.9541, 0.1151, -0.0075));
109  }
111  static RadialTangentialDistortion8 testObject()
112  {
113  return RadialTangentialDistortion8(0.6261, 0.001, -0.0002, 0.0001, 0.0001,
114  0.9541, 0.1151, -0.0075);
115  }
116 
120 
125  inline bool distort(const Eigen::Vector2d & pointUndistorted,
126  Eigen::Vector2d * pointDistorted) const;
127 
134  inline bool distort(const Eigen::Vector2d & pointUndistorted,
135  Eigen::Vector2d * pointDistorted,
136  Eigen::Matrix2d * pointJacobian,
137  Eigen::Matrix2Xd * parameterJacobian = NULL) const;
138 
146  inline bool distortWithExternalParameters(
147  const Eigen::Vector2d & pointUndistorted,
148  const Eigen::VectorXd & parameters, Eigen::Vector2d * pointDistorted,
149  Eigen::Matrix2d * pointJacobian = NULL,
150  Eigen::Matrix2Xd * parameterJacobian = NULL) const;
152 
156 
161  inline bool undistort(const Eigen::Vector2d & pointDistorted,
162  Eigen::Vector2d * pointUndistorted) const;
163 
169  inline bool undistort(const Eigen::Vector2d & pointDistorted,
170  Eigen::Vector2d * pointUndistorted,
171  Eigen::Matrix2d * pointJacobian) const;
173 
174  protected:
175  Eigen::Matrix<double, NumDistortionIntrinsics, 1> parameters_;
176 
177  double k1_;
178  double k2_;
179  double p1_;
180  double p2_;
181  double k3_;
182  double k4_;
183  double k5_;
184  double k6_;
185 };
186 
187 } // namespace cameras
188 } // namespace okvis
189 
191 
192 #endif /* INCLUDE_OKVIS_CAMERAS_RADIALTANGENTIALDISTORTION8_HPP_ */
bool undistort(const Eigen::Vector2d &pointDistorted, Eigen::Vector2d *pointUndistorted) const
Undistortion only.
Definition: RadialTangentialDistortion8.hpp:249
double k1_
radial parameter 1
Definition: RadialTangentialDistortion8.hpp:177
static RadialTangentialDistortion8 testObject()
Unit test support – create a test distortion object.
Definition: RadialTangentialDistortion8.hpp:111
Definition: RadialTangentialDistortion8.hpp:51
double k5_
radial parameter 3
Definition: RadialTangentialDistortion8.hpp:183
bool getParameters(Eigen::VectorXd &parameters) const
Obtain the generic parameters.
Definition: RadialTangentialDistortion8.hpp:82
double k6_
radial parameter 4
Definition: RadialTangentialDistortion8.hpp:184
double k2_
radial parameter 2
Definition: RadialTangentialDistortion8.hpp:178
bool distortWithExternalParameters(const Eigen::Vector2d &pointUndistorted, const Eigen::VectorXd &parameters, Eigen::Vector2d *pointDistorted, Eigen::Matrix2d *pointJacobian=NULL, Eigen::Matrix2Xd *parameterJacobian=NULL) const
Distortion and Jacobians using external distortion intrinsics parameters.
Definition: RadialTangentialDistortion8.hpp:183
EIGEN_MAKE_ALIGNED_OPERATOR_NEW RadialTangentialDistortion8()
The default constructor with all zero ki.
Definition: RadialTangentialDistortion8.hpp:48
double k3_
radial parameter 3
Definition: RadialTangentialDistortion8.hpp:181
static std::shared_ptr< DistortionBase > createTestObject()
Unit test support – create a test distortion object.
Definition: RadialTangentialDistortion8.hpp:104
Header file for the DistortionBase class.
bool setParameters(const Eigen::VectorXd &parameters)
set the generic parameters
Definition: RadialTangentialDistortion8.hpp:85
bool distort(const Eigen::Vector2d &pointUndistorted, Eigen::Vector2d *pointDistorted) const
Distortion only.
Definition: RadialTangentialDistortion8.hpp:103
double k4_
radial parameter 4
Definition: RadialTangentialDistortion8.hpp:182
double p1_
tangential parameter 1
Definition: RadialTangentialDistortion8.hpp:179
double p2_
tangential parameter 2
Definition: RadialTangentialDistortion8.hpp:180
static const int NumDistortionIntrinsics
Definition: RadialTangentialDistortion8.hpp:100
Base class for all distortion models.
Definition: DistortionBase.hpp:52
int numDistortionIntrinsics() const
Number of distortion parameters.
Definition: RadialTangentialDistortion8.hpp:95
std::string type() const
The class type.
Definition: RadialTangentialDistortion8.hpp:89
Eigen::Matrix< double, NumDistortionIntrinsics, 1 > parameters_
all distortion parameters
Definition: RadialTangentialDistortion8.hpp:175