Image Component Library (ICL)
|
00001 /******************************************************************** 00002 ** Image Component Library (ICL) ** 00003 ** ** 00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld ** 00005 ** Neuroinformatics Group ** 00006 ** Website: www.iclcv.org and ** 00007 ** http://opensource.cit-ec.de/projects/icl ** 00008 ** ** 00009 ** File : ICLGeom/src/ICLGeom/OpenCVCamCalib.h ** 00010 ** Module : ICLGeom ** 00011 ** Authors: Christian Groszewski ** 00012 ** ** 00013 ** ** 00014 ** GNU LESSER GENERAL PUBLIC LICENSE ** 00015 ** This file may be used under the terms of the GNU Lesser General ** 00016 ** Public License version 3.0 as published by the ** 00017 ** ** 00018 ** Free Software Foundation and appearing in the file LICENSE.GPL ** 00019 ** included in the packaging of this file. Please review the ** 00020 ** following information to ensure the license requirements will ** 00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt ** 00022 ** ** 00023 ** The development of this software was supported by the ** 00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. ** 00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche ** 00026 ** Forschungsgemeinschaft (DFG) in the context of the German ** 00027 ** Excellence Initiative. ** 00028 ** ** 00029 ********************************************************************/ 00030 00031 #pragma once 00032 00033 #include <ICLCore/Img.h> 00034 #include <ICLUtils/BasicTypes.h> 00035 #include <ICLMath/DynMatrix.h> 00036 00037 #include <ICLUtils/Macros.h> 00038 #include <ICLUtils/Uncopyable.h> 00039 00040 #include <ICLCore/OpenCV.h> 00041 00042 #ifdef HAVE_OPENCV 00043 #include <opencv/cv.h> 00044 #endif 00045 namespace icl{ 00046 namespace geom{ 00047 00049 class OpenCVCamCalib : public utils::Uncopyable{ 00050 00051 struct Data; 00053 Data *m_data; 00054 00055 public: 00057 00062 OpenCVCamCalib(unsigned int boardWidth=6, unsigned int boardHeight=9, unsigned int boardCount=8); 00063 00065 ~OpenCVCamCalib(); 00066 00068 /*@param img image to be searched for chessboard and points 00069 @return overall current number of found chessboard for calibration 00070 */ 00071 int addPoints(const core::ImgBase *img); 00072 00074 void calibrateCam(); 00075 00077 /*@return the new undistorted image*/ 00078 core::ImgBase *undisort(const core::ImgBase *img); 00079 00081 /*@param width of the chessboard 00082 @param height of the chessboard 00083 @param count minimum number of chessboards to be found on images before calibration*/ 00084 void resetData(int width, int height, int count); 00085 00087 /*@return intrinsic params*/ 00088 math::DynMatrix<icl64f> *getIntrinsics(); 00089 00091 /*@return distortion params*/ 00092 math::DynMatrix<icl64f> *getDistortion(); 00093 00095 void loadParams(const char* xmlfilename); 00096 00098 void saveParams(const char* xmlfilename); 00099 00100 }; 00101 } // namespace geom 00102 00103 } 00104