CameraSensorToolbox.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *   http://www.apache.org/licenses/LICENSE-2.0
00009 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016  
00017 
00018 #ifndef __IPA_CAMERASENSORTOOLBOX_H__
00019 #define __IPA_CAMERASENSORTOOLBOX_H__
00020 
00021 #ifdef __LINUX__
00022         #include "cob_vision_utils/CameraSensorDefines.h"
00023         #include "cob_vision_utils/CameraSensorTypes.h"
00024 #else
00025         #include "cob_perception_common/cob_vision_utils/common/include/cob_vision_utils/CameraSensorDefines.h"
00026         #include "cob_perception_common/cob_vision_utils/common/include/cob_vision_utils/CameraSensorTypes.h"
00027 #endif
00028 
00029 #include <opencv2/core/core.hpp>
00030 #include <map>
00031 #include <boost/shared_ptr.hpp>
00032 
00033 namespace ipa_CameraSensors {
00034 
00036 class CameraSensorToolbox;
00037 typedef boost::shared_ptr<CameraSensorToolbox> CameraSensorToolboxPtr;
00038 
00043 class __DLL_LIBCAMERASENSORS__ CameraSensorToolbox
00044 {
00045         public: 
00046                 CameraSensorToolbox();  
00047                 ~CameraSensorToolbox(); 
00048 
00049                 CameraSensorToolbox(const CameraSensorToolbox& cameraSensorToolbox); 
00050 
00052                 CameraSensorToolbox& operator= (const CameraSensorToolbox& cameraSensorToolbox); 
00053 
00056                 virtual unsigned long Release();
00057 
00065                 virtual unsigned long Init(std::string directory, ipa_CameraSensors::t_cameraType cameraType, int cameraIndex, const CvSize imageSize);
00066 
00076                 virtual unsigned long Init(const std::map<std::string, cv::Mat>* intrinsicMatrices,
00077                                                                         const std::map<std::string, cv::Mat>* distortionParameters,
00078                                                                         const std::map<std::string, cv::Mat>* extrinsicMatrices,
00079                                                                         const std::map<std::string, cv::Mat>* undistortMapsX,
00080                                                                         const std::map<std::string, cv::Mat>* undistortMapY,
00081                                                                         const CvSize imageSize);
00082 
00089                 virtual cv::Mat GetExtrinsicParameters(ipa_CameraSensors::t_cameraType cameraType, int cameraIndex);
00090 
00099                 virtual unsigned long SetExtrinsicParameters(ipa_CameraSensors::t_cameraType cameraType, int cameraIndex, 
00100                         const cv::Mat& _rotation, const cv::Mat& _translation);
00101 
00109                 virtual unsigned long SetExtrinsicParameters(std::string key, 
00110                         const cv::Mat& _rotation, const cv::Mat& _translation);
00111 
00116                 virtual cv::Mat GetIntrinsicMatrix(ipa_CameraSensors::t_cameraType cameraType, int cameraIndex);
00117 
00124                 virtual cv::Mat GetDistortionParameters(ipa_CameraSensors::t_cameraType cameraType, int cameraIndex);
00125 
00131                 virtual cv::Mat GetDistortionMapY(ipa_CameraSensors::t_cameraType cameraType, int cameraIndex);
00132 
00138                 virtual cv::Mat GetDistortionMapX(ipa_CameraSensors::t_cameraType cameraType, int cameraIndex);
00139 
00151                 virtual unsigned long SetIntrinsicParameters(ipa_CameraSensors::t_cameraType cameraType, int cameraIndex, 
00152                         const cv::Mat& _intrinsicMatrix, const cv::Mat& _distortion_coeffs);
00153 
00164                 virtual unsigned long SetIntrinsicParameters(std::string key, const cv::Mat& _intrinsicMatrix, const cv::Mat& _distortion_coeffs);
00165 
00173                 virtual unsigned long RemoveDistortion(ipa_CameraSensors::t_cameraType cameraType, int cameraIndex,
00174                         const cv::Mat& src, cv::Mat& dst);
00175 
00186                 virtual unsigned long ReprojectXYZ(ipa_CameraSensors::t_cameraType cameraType, int cameraIndex,
00187                         double x, double y, double z, int& u, int& v);
00188 
00189         private:
00190                 
00195                 virtual unsigned long ConvertCameraTypeToString(ipa_CameraSensors::t_cameraType cameraType, std::string &cameraTypeString);
00196 
00203                 virtual unsigned long LoadParameters(const char* filename, ipa_CameraSensors::t_cameraType cameraType, int cameraIndex);
00204 
00205                 bool m_Initialized; 
00206 
00207                 std::map<std::string, cv::Mat> m_intrinsicMatrices;     
00208                 std::map<std::string, cv::Mat> m_distortionCoeffs;      
00209                 std::map<std::string, cv::Mat> m_extrinsicMatrices; 
00210 
00211 
00212                 std::map<std::string, cv::Mat> m_undistortMapsX;        
00213                 std::map<std::string, cv::Mat> m_undistortMapsY;        
00214 
00215                 CvSize m_ImageSize; 
00216 };
00217 
00220 __DLL_LIBCAMERASENSORS__ CameraSensorToolboxPtr CreateCameraSensorToolbox();
00221 
00222 } // end namespace
00223 #endif // __IPA_CAMERASENSORTOOLBOX_H__


cob_vision_utils
Author(s): Jan Fischer
autogenerated on Fri Mar 15 2019 03:10:16