Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
DCDevice.h
Go to the documentation of this file.
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   : ICLIO/src/ICLIO/DCDevice.h                             **
00010 ** Module : ICLIO                                                  **
00011 ** Authors: Christof Elbrechter                                    **
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.LGPL **
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 <ICLIO/DC.h>
00034 #include <string>
00035 #include <vector>
00036 #include <ICLCore/Types.h>
00037 #include <ICLUtils/Size.h>
00038 
00039 namespace icl{
00040   namespace io{
00042     class DCGrabber;
00043     namespace dc{
00044       class DCGrabberThread;
00045     }
00048 
00049     class ICLIO_API DCDevice{
00050       public:
00051   
00053       static std::string getTypeID(const std::string &model, const std::string &vendor);
00054       
00056       static std::string getTypeID(const dc1394camera_t *cam);
00057       
00059 
00060       std::string getTypeID() const{ return getTypeID(m_poCam); }
00061       
00063       static const DCDevice null;
00064       
00066       friend class icl::io::DCGrabber;
00067   
00069       friend class icl::io::dc::DCGrabberThread;
00070       
00072       static void dc1394_reset_bus(bool verbose=false);
00073       
00075       struct ICLIO_API Mode{
00077         Mode(dc1394video_mode_t vm, dc1394framerate_t fr):
00078           videomode(vm),framerate(fr){}
00079         
00081 
00082         Mode(const std::string &stringRepr);
00083   
00085         Mode(dc1394camera_t *cam);
00086         
00088 
00089         std::string toString() const;
00090   
00092         bool supportedBy(dc1394camera_t *cam) const;
00093   
00095         dc1394video_mode_t videomode;
00096         
00098         dc1394framerate_t framerate;
00099         
00101         bool operator==(const Mode &m) const{ return videomode == m.videomode && framerate == m.framerate; }
00102         
00104         bool operator!=(const Mode &m) const{ return !((*this)==m);}
00105       };
00106       
00108       dc1394camera_t *getCam() const { return m_poCam; }
00109   
00111       Mode getMode() const{ return Mode(m_poCam); }
00112       
00114       std::vector<Mode> getModes() const ;
00115 
00117       std::string getModesInfo() const ;
00118   
00120       std::string getVendorID() const;
00121       
00123       std::string getModelID() const;
00124       
00126       uint64_t getGUID() const;
00127   
00129       icl32s getUnit() const;
00130   
00132       icl32s getUnitSpecID() const;
00133   
00135 
00136       std::string getUniqueStringIdentifier() const;
00137       
00139       bool isNull() const { return m_poCam == 0; }
00140       
00142       void show(const std::string &title="DCDevice") const;
00143          
00145       bool supports(const Mode &mode) const;
00146       
00148 
00153       dc1394color_filter_t getBayerFilterLayout() const;
00154   
00156 
00157       void setISOSpeed(int mbits);
00158       
00160       bool supportsDC800();
00161       
00162       private:    
00164       DCDevice(dc1394camera_t *cam):
00165       m_poCam(cam){//,m_eCameraTypeID(estimateCameraType(cam)){
00166         estimateBayerFilterMode();
00167       }
00168   
00170 
00171       void setMode(const Mode &mode);
00172   
00174 
00175       void reset() { if(!isNull()) dc1394_camera_reset(m_poCam); }
00176   
00177   
00179       dc1394camera_t *m_poCam;
00180   
00182       void estimateBayerFilterMode();
00183   
00184       enum BayerFilterMode{
00185         BF_RGGB = DC1394_COLOR_FILTER_RGGB,
00186         BF_GBRG = DC1394_COLOR_FILTER_GBRG,
00187         BF_GRBG = DC1394_COLOR_FILTER_GRBG,
00188         BF_BGGR = DC1394_COLOR_FILTER_BGGR,
00189         BF_NONE,
00190         BF_FROM_MODE,
00191         BF_FROM_FEATURE
00192       };
00193   
00195       // CameraTypeID m_eCameraTypeID;
00196       BayerFilterMode m_eBayerFilterMode;
00197     };
00198   } // namespace io
00199 }
00200 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines