Calibration.h
Go to the documentation of this file.
1 // ****************************************************************************
2 // This file is part of the Integrating Vision Toolkit (IVT).
3 //
4 // The IVT is maintained by the Karlsruhe Institute of Technology (KIT)
5 // (www.kit.edu) in cooperation with the company Keyetech (www.keyetech.de).
6 //
7 // Copyright (C) 2014 Karlsruhe Institute of Technology (KIT).
8 // All rights reserved.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are met:
12 //
13 // 1. Redistributions of source code must retain the above copyright
14 // notice, this list of conditions and the following disclaimer.
15 //
16 // 2. Redistributions in binary form must reproduce the above copyright
17 // notice, this list of conditions and the following disclaimer in the
18 // documentation and/or other materials provided with the distribution.
19 //
20 // 3. Neither the name of the KIT nor the names of its contributors may be
21 // used to endorse or promote products derived from this software
22 // without specific prior written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE KIT AND CONTRIBUTORS “AS IS” AND ANY
25 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 // DISCLAIMED. IN NO EVENT SHALL THE KIT OR CONTRIBUTORS BE LIABLE FOR ANY
28 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 // ****************************************************************************
35 // ****************************************************************************
36 // Filename: Calibration.h
37 // Author: Pedram Azad
38 // Date: 2004
39 // ****************************************************************************
40 
44 #ifndef _CALIBRATION_H_
45 #define _CALIBRATION_H_
46 
47 
48 // ****************************************************************************
49 // Necessary includes
50 // ****************************************************************************
51 
52 #include "Math/Math2d.h"
53 #include "Math/Math3d.h"
54 
55 
56 
57 // ****************************************************************************
58 // CCalibration
59 // ****************************************************************************
60 
126 {
127 public:
134  {
136  int width;
138  int height;
144  float distortion[4];
149  };
150 
151 
160  CCalibration();
161 
165  ~CCalibration();
166 
167 
172  void Set(const CCalibration &calibration);
173 
190  void SetCameraParameters(float fx, float fy, float cx, float cy,
191  float d1, float d2, float d3, float d4,
192  const Mat3d &R, const Vec3d &t, int width, int height);
193 
202  void SetIntrinsicBase(float cx, float cy, float fx, float fy);
203 
212  void SetDistortion(float d1, float d2, float d3, float d4);
213 
221  void SetRotation(const Mat3d &R);
222 
230  void SetTranslation(const Vec3d &t);
231 
232 
248  void GetCalibrationMatrix(Mat3d &K) const;
249 
262  void GetProjectionMatrix(Mat3d &P1, Vec3d &p2) const;
263 
269 
270 
283  bool LoadCameraParameters(const char *pCameraParameterFileName, int nCamera = 0, bool bSetExtrinsicToIdentity = false);
284 
293  bool SaveCameraParameters(const char *pCameraParameterFileName) const;
294 
298  void PrintCameraParameters() const;
299 
300 
311  void WorldToImageCoordinates(const Vec3d &worldPoint, Vec2d &imagePoint, bool bUseDistortionParameters = true) const;
312 
326  void ImageToWorldCoordinates(const Vec2d &imagePoint, Vec3d &worldPoint, float zc = 1.0f, bool bUseDistortionParameters = true) const;
327 
328 
337  void WorldToCameraCoordinates(const Vec3d &worldPoint, Vec3d &cameraPoint) const;
338 
347  void CameraToWorldCoordinates(const Vec3d &cameraPoint, Vec3d &worldPoint) const;
348 
349 
360  void CameraToImageCoordinates(const Vec3d &cameraPoint, Vec2d &imagePoint, bool bUseDistortionParameters = true) const;
361 
375  void ImageToCameraCoordinates(const Vec2d &imagePoint, Vec3d &cameraPoint, float zc = 1.0f, bool bUseDistortionParameters = true) const;
376 
377 
388  void UndistortImageCoordinates(const Vec2d &distortedImagePoint, Vec2d &undistortedImagePoint) const;
389 
398  void DistortImageCoordinates(const Vec2d &undistortedImagePoint, Vec2d &distortedImagePoint) const;
399 
400 
407  void UndistortCameraCoordinates(const Vec2d &distortedCameraPoint, Vec2d &undistortedCameraPoint) const;
408 
415  void DistortCameraCoordinates(const Vec2d &undistortedCameraPoint, Vec2d &distortedCameraPoint) const;
416 
423  void GetCameraCoordinates(const Vec3d &worldPoint, Vec2d &imagePoint, bool bUseDistortionParameters = true) const;
424 
431  void GetWorldCoordinates(const Vec2d &imagePoint, Vec3d &worldPoint, float zc = 1.0f, bool bUseDistortionParameters = true) const;
432 
433 
444 
455 
456 
457 private:
458  // private methods
461 
462  // private attributes
463 
464  // intrinsic camera parameters
466 };
467 
468 
469 
470 #endif /* _CALIBRATION_H_ */
Struct containing all parameters of the camera model.
Definition: Calibration.h:133
Mat3d m_rotation_inverse
Rotation matrix of the inverted extrinsic transformation.
Definition: Calibration.h:443
GLdouble GLdouble t
Definition: glext.h:3219
void SetDistortion(float d1, float d2, float d3, float d4)
Sets the distortion parameters of the distortion model.
void ImageToCameraCoordinates(const Vec2d &imagePoint, Vec3d &cameraPoint, float zc=1.0f, bool bUseDistortionParameters=true) const
Transforms 2D image coordinates to 3D camera coordinates.
CCameraParameters m_cameraParameters
Definition: Calibration.h:465
void SetCameraParameters(float fx, float fy, float cx, float cy, float d1, float d2, float d3, float d4, const Mat3d &R, const Vec3d &t, int width, int height)
Initializes the camera model, given a complete parameter set.
void UndistortImageCoordinates(const Vec2d &distortedImagePoint, Vec2d &undistortedImagePoint) const
Transforms 2D distorted image coordinates to 2D undistorted image coordinates.
void CameraToWorldCoordinates(const Vec3d &cameraPoint, Vec3d &worldPoint) const
Transforms 3D camera coordinates to 3D world coordinates.
bool LoadCameraParameters(const char *pCameraParameterFileName, int nCamera=0, bool bSetExtrinsicToIdentity=false)
Initializes the camera model, given a file path to a camera parameter file.
Data structure for the representation of a 3D vector.
Definition: Math3d.h:73
void CameraToImageCoordinates(const Vec3d &cameraPoint, Vec2d &imagePoint, bool bUseDistortionParameters=true) const
Transforms 3D camera coordinates to 2D image coordinates.
void DistortImageCoordinates(const Vec2d &undistortedImagePoint, Vec2d &distortedImagePoint) const
Transforms 2D undistorted image coordinates to 2D distorted image coordinates.
void GetCalibrationMatrix(Mat3d &K) const
Sets up the calibration matrix K.
Definition: Calibration.cpp:91
void PrintCameraParameters() const
Prints all camera parameters in the console window (STDOUT).
const CCameraParameters & GetCameraParameters() const
Gives access to the camera parameters.
Definition: Calibration.h:268
bool SaveCameraParameters(const char *pCameraParameterFileName) const
Writes the parameters of the camera model to camera parameter file.
void GetCameraCoordinates(const Vec3d &worldPoint, Vec2d &imagePoint, bool bUseDistortionParameters=true) const
Deprecated.
void ImageToWorldCoordinates(const Vec2d &imagePoint, Vec3d &worldPoint, float zc=1.0f, bool bUseDistortionParameters=true) const
Transforms 2D image coordinates to 3D world coordinates.
void GetProjectionMatrix(Mat3d &P1, Vec3d &p2) const
Sets up the projection matrix P.
Definition: Calibration.cpp:99
void SetIntrinsicBase(float cx, float cy, float fx, float fy)
Sets the principal point and the focal lengths.
void GetWorldCoordinates(const Vec2d &imagePoint, Vec3d &worldPoint, float zc=1.0f, bool bUseDistortionParameters=true) const
Deprecated.
~CCalibration()
The destructor.
Definition: Calibration.cpp:82
void UndistortCameraCoordinates(const Vec2d &distortedCameraPoint, Vec2d &undistortedCameraPoint) const
Deprecated.
void DistortCameraCoordinates(const Vec2d &undistortedCameraPoint, Vec2d &distortedCameraPoint) const
Deprecated.
CCalibration()
The default constructor.
Definition: Calibration.cpp:68
Vec3d m_translation_inverse
Translation vector of the inverted extrinsic transformation.
Definition: Calibration.h:454
GLenum GLsizei width
Definition: glext.h:3122
GLenum GLsizei GLsizei height
Definition: glext.h:3132
void Set(const CCalibration &calibration)
Initializes the camera model, given an instance of CCalibration.
void CalculateRadialLensDistortion()
Data structure for the representation of a 2D vector.
Definition: Math2d.h:82
void SetTranslation(const Vec3d &t)
Sets the extrinsic parameter t (translation vector).
void CalculateInverseTransformation()
void WorldToCameraCoordinates(const Vec3d &worldPoint, Vec3d &cameraPoint) const
Transforms 3D world coordinates to 3D camera coordinates.
void SetRotation(const Mat3d &R)
Sets the extrinsic parameter R (rotation matrix).
Data structure for the representation of a 3x3 matrix.
Definition: Math3d.h:93
Camera model parameters and functions for a single camera.
Definition: Calibration.h:125
void WorldToImageCoordinates(const Vec3d &worldPoint, Vec2d &imagePoint, bool bUseDistortionParameters=true) const
Transforms 3D world coordinates to 2D image coordinates.


asr_ivt
Author(s): Allgeyer Tobias, Hutmacher Robin, Kleinert Daniel, Meißner Pascal, Scholz Jonas, Stöckle Patrick
autogenerated on Mon Dec 2 2019 03:47:27