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 00022 00023 #ifndef __IPA_VIRTUALCOLORCAM_H__ 00024 #define __IPA_VIRTUALCOLORCAM_H__ 00025 00026 #include "StdAfx.h" 00027 #ifdef __LINUX__ 00028 #include "cob_camera_sensors/AbstractColorCamera.h" 00029 #else 00030 #include "cob_driver/cob_camera_sensors/common/include/cob_camera_sensors/AbstractColorCamera.h" 00031 #endif 00032 00033 #include <cstdlib> 00034 #include <boost/filesystem.hpp> 00035 00036 namespace ipa_CameraSensors { 00041 class __DLL_LIBCAMERASENSORS__ VirtualColorCam : public AbstractColorCamera 00042 { 00043 private: 00044 int m_ImageWidth; 00045 int m_ImageHeight; 00046 00047 std::string m_CameraDataDirectory; 00048 int m_CameraIndex; 00049 00050 std::vector<std::string> m_ColorImageFileNames; 00051 00052 unsigned int m_ImageCounter; 00053 00059 unsigned long LoadParameters(const char* filename, int cameraIndex); 00060 00061 unsigned long SetParameters(){return RET_OK;}; 00062 00063 public: 00064 00065 VirtualColorCam (); 00066 ~VirtualColorCam (); 00067 00068 //******************************************************************************* 00069 // AbstractColorCamera interface implementation 00070 //******************************************************************************* 00071 00072 unsigned long Init(std::string directory, int cameraIndex = 0); 00073 00074 unsigned long Open(); 00075 unsigned long Close(); 00076 00077 unsigned long GetColorImage(char* colorImageData, bool getLatestFrame); 00078 unsigned long GetColorImage(cv::Mat* image, bool getLatestFrame); 00079 00080 unsigned long SaveParameters(const char* filename); //speichert die Parameter in das File 00081 unsigned long SetProperty(t_cameraProperty* cameraProperty); 00082 unsigned long SetPropertyDefaults(); 00083 unsigned long GetProperty(t_cameraProperty* cameraProperty); 00084 unsigned long PrintCameraInformation(); 00085 unsigned long TestCamera(const char* filename); 00086 00087 //******************************************************************************* 00088 // Camera specific functions 00089 //******************************************************************************* 00090 00093 int GetNumberOfImages(); 00094 00099 unsigned long SetPathToImages(std::string path); 00100 00101 }; 00102 00105 __DLL_LIBCAMERASENSORS__ AbstractColorCameraPtr CreateColorCamera_VirtualCam(); 00106 00107 } // end namespace ipa_CameraSensors 00108 00109 #endif //__IPA_VIRTUALCOLORCAM_H__ 00110 00111