OKVIS ROS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ReprojectionErrorBase.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: Jan 4, 2014
30  * Author: Stefan Leutenegger (s.leutenegger@imperial.ac.uk)
31  *********************************************************************************/
32 
39 #ifndef INCLUDE_OKVIS_CERES_REPROJECTIONERRORBASE_HPP_
40 #define INCLUDE_OKVIS_CERES_REPROJECTIONERRORBASE_HPP_
41 
42 #include "ceres/ceres.h"
43 
45 namespace okvis {
47 namespace ceres {
48 
51  public ::ceres::SizedCostFunction<2 /* number of residuals */,
52  7 /* size of first parameter */, 4 /* size of second parameter */, 7 /* size of third parameter (camera extrinsics) */>,
53  public ErrorInterface {
54  public:
55 
57  uint64_t cameraId() const {
58  return cameraId_;
59  }
60 
63  void setCameraId(uint64_t cameraId) {
65  }
66 
67  uint64_t cameraId_;
68 };
69 
72  public:
73 
75  typedef Eigen::Vector2d measurement_t;
76 
78  typedef Eigen::Matrix2d covariance_t;
79 
82  virtual void setMeasurement(const measurement_t& measurement) = 0;
83 
86  virtual void setInformation(const covariance_t& information) = 0;
87 
88  // getters
91  virtual const measurement_t& measurement() const = 0;
92 
95  virtual const covariance_t& information() const = 0;
96 
99  virtual const covariance_t& covariance() const = 0;
100 
101 };
102 
103 }
104 
105 }
106 
107 #endif /* INCLUDE_OKVIS_CERES_REPROJECTIONERRORBASE_HPP_ */
virtual void setMeasurement(const measurement_t &measurement)=0
Set the measurement.
virtual const measurement_t & measurement() const =0
Get the measurement.
Reprojection error base class.
Definition: ReprojectionErrorBase.hpp:50
Simple interface class the errors implemented here should inherit from.
Definition: ErrorInterface.hpp:53
uint64_t cameraId_
ID of the camera.
Definition: ReprojectionErrorBase.hpp:67
virtual const covariance_t & information() const =0
Get the information matrix.
2D keypoint reprojection error base class.
Definition: ReprojectionErrorBase.hpp:71
Eigen::Vector2d measurement_t
Measurement type (2D).
Definition: ReprojectionErrorBase.hpp:75
virtual void setInformation(const covariance_t &information)=0
Set the information.
Eigen::Matrix2d covariance_t
Covariance / information matrix type (2x2).
Definition: ReprojectionErrorBase.hpp:78
virtual const covariance_t & covariance() const =0
Get the covariance matrix.
uint64_t cameraId() const
Camera ID.
Definition: ReprojectionErrorBase.hpp:57
void setCameraId(uint64_t cameraId)
Set camera ID.
Definition: ReprojectionErrorBase.hpp:63