Calibration.h
Go to the documentation of this file.
00001 // ****************************************************************************
00002 // This file is part of the Integrating Vision Toolkit (IVT).
00003 //
00004 // The IVT is maintained by the Karlsruhe Institute of Technology (KIT)
00005 // (www.kit.edu) in cooperation with the company Keyetech (www.keyetech.de).
00006 //
00007 // Copyright (C) 2014 Karlsruhe Institute of Technology (KIT).
00008 // All rights reserved.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are met:
00012 //
00013 // 1. Redistributions of source code must retain the above copyright
00014 //    notice, this list of conditions and the following disclaimer.
00015 //
00016 // 2. Redistributions in binary form must reproduce the above copyright
00017 //    notice, this list of conditions and the following disclaimer in the
00018 //    documentation and/or other materials provided with the distribution.
00019 //
00020 // 3. Neither the name of the KIT nor the names of its contributors may be
00021 //    used to endorse or promote products derived from this software
00022 //    without specific prior written permission.
00023 //
00024 // THIS SOFTWARE IS PROVIDED BY THE KIT AND CONTRIBUTORS “AS IS” AND ANY
00025 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00026 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00027 // DISCLAIMED. IN NO EVENT SHALL THE KIT OR CONTRIBUTORS BE LIABLE FOR ANY
00028 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00029 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00031 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00032 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00033 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034 // ****************************************************************************
00035 // ****************************************************************************
00036 // Filename:  Calibration.h
00037 // Author:    Pedram Azad
00038 // Date:      2004
00039 // ****************************************************************************
00040 
00044 #ifndef _CALIBRATION_H_
00045 #define _CALIBRATION_H_
00046 
00047 
00048 // ****************************************************************************
00049 // Necessary includes
00050 // ****************************************************************************
00051 
00052 #include "Math/Math2d.h"
00053 #include "Math/Math3d.h"
00054 
00055 
00056 
00057 // ****************************************************************************
00058 // CCalibration
00059 // ****************************************************************************
00060 
00125 class CCalibration
00126 {
00127 public:
00133         struct CCameraParameters
00134         {
00136                 int width;
00138                 int height;
00140                 Vec2d principalPoint;
00142                 Vec2d focalLength;
00144                 float distortion[4];
00146                 Mat3d rotation;
00148                 Vec3d translation;
00149         };
00150 
00151 
00160         CCalibration();
00161 
00165         ~CCalibration();
00166 
00167         
00172         void Set(const CCalibration &calibration);
00173         
00190         void SetCameraParameters(float fx, float fy, float cx, float cy,
00191                           float d1, float d2, float d3, float d4,
00192                           const Mat3d &R, const Vec3d &t, int width, int height);
00193         
00202         void SetIntrinsicBase(float cx, float cy, float fx, float fy);
00203         
00212         void SetDistortion(float d1, float d2, float d3, float d4);
00213 
00221         void SetRotation(const Mat3d &R);
00222         
00230         void SetTranslation(const Vec3d &t);
00231         
00232         
00248         void GetCalibrationMatrix(Mat3d &K) const;
00249         
00262         void GetProjectionMatrix(Mat3d &P1, Vec3d &p2) const;
00263         
00268         const CCameraParameters& GetCameraParameters() const { return m_cameraParameters; }
00269         
00270 
00283         bool LoadCameraParameters(const char *pCameraParameterFileName, int nCamera = 0, bool bSetExtrinsicToIdentity = false);
00284         
00293         bool SaveCameraParameters(const char *pCameraParameterFileName) const;
00294         
00298         void PrintCameraParameters() const;
00299         
00300         
00311         void WorldToImageCoordinates(const Vec3d &worldPoint, Vec2d &imagePoint, bool bUseDistortionParameters = true) const;
00312         
00326         void ImageToWorldCoordinates(const Vec2d &imagePoint, Vec3d &worldPoint, float zc = 1.0f, bool bUseDistortionParameters = true) const;
00327         
00328         
00337         void WorldToCameraCoordinates(const Vec3d &worldPoint, Vec3d &cameraPoint) const;
00338         
00347         void CameraToWorldCoordinates(const Vec3d &cameraPoint, Vec3d &worldPoint) const;
00348 
00349         
00360         void CameraToImageCoordinates(const Vec3d &cameraPoint, Vec2d &imagePoint, bool bUseDistortionParameters = true) const;
00361         
00375         void ImageToCameraCoordinates(const Vec2d &imagePoint, Vec3d &cameraPoint, float zc = 1.0f, bool bUseDistortionParameters = true) const;
00376         
00377         
00388         void UndistortImageCoordinates(const Vec2d &distortedImagePoint, Vec2d &undistortedImagePoint) const;
00389         
00398         void DistortImageCoordinates(const Vec2d &undistortedImagePoint, Vec2d &distortedImagePoint) const;
00399         
00400         
00407         void UndistortCameraCoordinates(const Vec2d &distortedCameraPoint, Vec2d &undistortedCameraPoint) const;
00408         
00415         void DistortCameraCoordinates(const Vec2d &undistortedCameraPoint, Vec2d &distortedCameraPoint) const;
00416         
00423         void GetCameraCoordinates(const Vec3d &worldPoint, Vec2d &imagePoint, bool bUseDistortionParameters = true) const;
00424         
00431         void GetWorldCoordinates(const Vec2d &imagePoint, Vec3d &worldPoint, float zc = 1.0f, bool bUseDistortionParameters = true) const;
00432         
00433         
00443         Mat3d m_rotation_inverse;
00444         
00454         Vec3d m_translation_inverse;
00455 
00456 
00457 private:
00458         // private methods
00459         void CalculateInverseTransformation();
00460         void CalculateRadialLensDistortion();
00461         
00462         // private attributes
00463 
00464         // intrinsic camera parameters
00465         CCameraParameters m_cameraParameters;
00466 };
00467 
00468 
00469 
00470 #endif /* _CALIBRATION_H_ */


asr_ivt
Author(s): Allgeyer Tobias, Hutmacher Robin, Kleinert Daniel, Meißner Pascal, Scholz Jonas, Stöckle Patrick
autogenerated on Thu Jun 6 2019 21:46:57