AVTPikeCam.h
Go to the documentation of this file.
00001 /****************************************************************
00002 *
00003 * Copyright (c) 2010
00004 *
00005 * Fraunhofer Institute for Manufacturing Engineering
00006 * and Automation (IPA)
00007 *
00008 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00009 *
00010 * Project name: care-o-bot
00011 * ROS stack name: cob_driver
00012 * ROS package name: cob_camera_sensors
00013 * Description: Interface to AVTPikeCam Firewire Camera.
00014 *
00015 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00016 *
00017 * Author: Jan Fischer, email:jan.fischer@ipa.fhg.de
00018 * Supervised by: Jan Fischer, email:jan.fischer@ipa.fhg.de
00019 *
00020 * Date of creation: Nov 2008
00021 * ToDo:
00022 *
00023 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00024 *
00025 * Redistribution and use in source and binary forms, with or without
00026 * modification, are permitted provided that the following conditions are met:
00027 *
00028 * * Redistributions of source code must retain the above copyright
00029 * notice, this list of conditions and the following disclaimer.
00030 * * Redistributions in binary form must reproduce the above copyright
00031 * notice, this list of conditions and the following disclaimer in the
00032 * documentation and/or other materials provided with the distribution.
00033 * * Neither the name of the Fraunhofer Institute for Manufacturing
00034 * Engineering and Automation (IPA) nor the names of its
00035 * contributors may be used to endorse or promote products derived from
00036 * this software without specific prior written permission.
00037 *
00038 * This program is free software: you can redistribute it and/or modify
00039 * it under the terms of the GNU Lesser General Public License LGPL as
00040 * published by the Free Software Foundation, either version 3 of the
00041 * License, or (at your option) any later version.
00042 *
00043 * This program is distributed in the hope that it will be useful,
00044 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00045 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00046 * GNU Lesser General Public License LGPL for more details.
00047 *
00048 * You should have received a copy of the GNU Lesser General Public
00049 * License LGPL along with this program.
00050 * If not, see <http://www.gnu.org/licenses/>.
00051 *
00052 ****************************************************************/
00053  
00058 
00059 
00060 #ifndef __IPA_AVTPIKECAM_H__
00061 #define __IPA_AVTPIKECAM_H__
00062 
00063 #include "StdAfx.h"
00064 
00065 #ifdef __LINUX__
00066         #include "cob_camera_sensors/AbstractColorCamera.h"
00067 #else
00068         #include "cob_driver/cob_camera_sensors/common/include/cob_camera_sensors/AbstractColorCamera.h"
00069 #endif
00070 
00071 #include <cstdlib>
00072 
00073 #ifdef _WIN32
00074         #include <fgcamera.h>
00075         #ifdef __MINGW__
00076         typedef unsigned char UINT8;
00077         #endif
00078 #endif
00079 
00080 #define UINT8P_CAST(x) reinterpret_cast<UINT8*>(x)
00081 
00082 #ifdef __LINUX__
00083         #include <dc1394/dc1394.h>
00084         typedef struct
00085         {
00086           unsigned long Low;
00087           unsigned long High;
00088         }UINT32HL;
00089         #define UINT32 unsigned long
00090         #define _UINT32HL
00091 #endif
00092 
00093 #ifdef SWIG
00094 %module Sensors
00095 %include "Source/Vision/CameraSensors/AbstractColorCamera.h"
00096 
00097 %{
00098         #include "AVTPikeCam.h"
00099 %}
00100 #endif
00101 
00102 using namespace std;
00103 
00104 namespace ipa_CameraSensors {
00105 
00109 class __DLL_LIBCAMERASENSORS__ AVTPikeCam : public AbstractColorCamera
00110 {
00116         class AVTPikeCamDeleter
00117         {
00118         public:
00119                 ~AVTPikeCamDeleter() 
00120                 {
00121 #ifndef __LINUX__
00122                         FGExitModule();
00123 #endif
00124                 };
00125         };
00126 
00127         private:
00129                 bool m_operationMode_B; 
00130                 UINT32HL m_GUID;                        
00131                 static bool m_OpenExecuted; 
00132                 static AVTPikeCamDeleter m_Deleter; 
00133 
00134 #ifdef __LINUX__
00135                 dc1394video_frame_t* m_Frame;
00136                 dc1394_t* m_IEEE1394Info;       
00137                 dc1394camera_list_t* m_IEEE1394Cameras; 
00138                 dc1394camera_t* m_cam;          
00139                 dc1394video_modes_t m_availableVideoModes; 
00140 
00141                 dc1394speed_t m_IsoSpeed;                       
00142                 dc1394framerate_t m_FrameRate;          
00143                 dc1394video_mode_t m_VideoMode;         
00144                 dc1394color_coding_t m_ColorCoding;     
00145 #endif
00146 
00147 #ifdef _WIN32
00148                 CFGCamera m_cam;                        
00149                 FGNODEINFO m_nodeInfo[5];       
00150                 UINT32 m_NodeCnt;                       
00151                 FGFRAME m_Frame; 
00152 #endif
00153 
00154 
00155 
00156 
00157 
00158                 unsigned long LoadParameters(const char* filename, int cameraIndex);
00159 
00163                 unsigned long SetParameters();
00164 
00165         public:
00166 
00168                 AVTPikeCam ();
00170                 ~AVTPikeCam ();
00171 
00172                 //*******************************************************************************
00173                 // AbstractColorCamera interface implementation
00174                 //*******************************************************************************
00175 
00176                 unsigned long Init(std::string directory, int cameraIndex = 0);
00177 
00178                 unsigned long Open();
00179                 unsigned long Close();
00180 
00181                 unsigned long GetColorImage(char* colorImageData, bool getLatestFrame);
00182                 unsigned long GetColorImage(cv::Mat* colorImage, bool getLatestFrame);
00183 
00184                 unsigned long SaveParameters(const char* filename);             //speichert die Parameter in das File
00185 
00201                 unsigned long SetProperty(t_cameraProperty* cameraProperty);
00202                 unsigned long SetPropertyDefaults();
00203                 unsigned long GetProperty(t_cameraProperty* cameraProperty);
00204 
00207                 unsigned long PrintCameraInformation();
00208                 unsigned long TestCamera(const char* filename);
00209 
00210                 //*******************************************************************************
00211                 // Camera specific functions
00212                 //*******************************************************************************
00213                 
00214 };
00215 
00218 __DLL_LIBCAMERASENSORS__ AbstractColorCameraPtr CreateColorCamera_AVTPikeCam();
00219 
00220 } // end namespace ipa_CameraSensors
00221 
00222 #endif //__IPA_AVTPIKECAM_H__
00223 
00224 


cob_camera_sensors
Author(s): Jan Fischer
autogenerated on Sun Oct 5 2014 23:07:54