Image Component Library (ICL)
DCDevice.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLIO/src/ICLIO/DCDevice.h **
10 ** Module : ICLIO **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLIO/DC.h>
34 #include <string>
35 #include <vector>
36 #include <ICLCore/Types.h>
37 #include <ICLUtils/Size.h>
38 
39 namespace icl{
40  namespace io{
42  class DCGrabber;
43  namespace dc{
44  class DCGrabberThread;
45  }
48  class ICLIO_API DCDevice{
50  public:
51 
53  static std::string getTypeID(const std::string &model, const std::string &vendor);
54 
56  static std::string getTypeID(const dc1394camera_t *cam);
57 
59 
60  std::string getTypeID() const{ return getTypeID(m_poCam); }
61 
63  static const DCDevice null;
64 
66  friend class icl::io::DCGrabber;
67 
70 
72  static void dc1394_reset_bus(bool verbose=false);
73 
75  struct ICLIO_API Mode{
77  Mode(dc1394video_mode_t vm, dc1394framerate_t fr):
78  videomode(vm),framerate(fr){}
79 
81 
82  Mode(const std::string &stringRepr);
83 
85  Mode(dc1394camera_t *cam);
86 
88 
89  std::string toString() const;
90 
92  bool supportedBy(dc1394camera_t *cam) const;
93 
95  dc1394video_mode_t videomode;
96 
98  dc1394framerate_t framerate;
99 
101  bool operator==(const Mode &m) const{ return videomode == m.videomode && framerate == m.framerate; }
102 
104  bool operator!=(const Mode &m) const{ return !((*this)==m);}
105  };
106 
108  dc1394camera_t *getCam() const { return m_poCam; }
109 
111  Mode getMode() const{ return Mode(m_poCam); }
112 
114  std::vector<Mode> getModes() const ;
115 
117  std::string getModesInfo() const ;
118 
120  std::string getVendorID() const;
121 
123  std::string getModelID() const;
124 
126  uint64_t getGUID() const;
127 
129  icl32s getUnit() const;
130 
132  icl32s getUnitSpecID() const;
133 
135 
136  std::string getUniqueStringIdentifier() const;
137 
139  bool isNull() const { return m_poCam == 0; }
140 
142  void show(const std::string &title="DCDevice") const;
143 
145  bool supports(const Mode &mode) const;
146 
148 
153  dc1394color_filter_t getBayerFilterLayout() const;
154 
156 
157  void setISOSpeed(int mbits);
158 
160  bool supportsDC800();
161 
162  private:
164  DCDevice(dc1394camera_t *cam):
165  m_poCam(cam){//,m_eCameraTypeID(estimateCameraType(cam)){
166  estimateBayerFilterMode();
167  }
168 
170 
171  void setMode(const Mode &mode);
172 
174 
175  void reset() { if(!isNull()) dc1394_camera_reset(m_poCam); }
176 
177 
179  dc1394camera_t *m_poCam;
180 
182  void estimateBayerFilterMode();
183 
185  BF_RGGB = DC1394_COLOR_FILTER_RGGB,
186  BF_GBRG = DC1394_COLOR_FILTER_GBRG,
187  BF_GRBG = DC1394_COLOR_FILTER_GRBG,
188  BF_BGGR = DC1394_COLOR_FILTER_BGGR,
191  BF_FROM_FEATURE
192  };
193 
195  // CameraTypeID m_eCameraTypeID;
197  };
198  } // namespace io
199 }
200 
undocument this line if you encounter any issues!
Definition: Any.h:37
Mode(dc1394video_mode_t vm, dc1394framerate_t fr)
creates a new Mode with given videomode and framerate
Definition: DCDevice.h:77
BayerFilterMode m_eBayerFilterMode
once estimated this flag is used to identify the current camery type
Definition: DCDevice.h:196
DCDevice(dc1394camera_t *cam)
Creates a new device (pivate; called by DCGrabber::getDeviceList())
Definition: DCDevice.h:164
bool operator==(const Mode &m) const
compares to modes
Definition: DCDevice.h:101
void reset()
resets the camera internally
Definition: DCDevice.h:175
Grabber implementation for handling DC-Devices using libdc1394 (Version >= 2.0.rc9) .
Definition: DCGrabber.h:87
dc1394video_mode_t videomode
corresponding videomode
Definition: DCDevice.h:95
bool isNull() const
returns wheather the device is associated to a dc-camera
Definition: DCDevice.h:139
dc1394camera_t * getCam() const
returns the camera, which is associated with this device (fixed)
Definition: DCDevice.h:108
Ipp32s icl32s
32bit signed integer type for the ICL
Definition: BasicTypes.h:58
Internally used Mode struct (combination of videomode and framerate)
Definition: DCDevice.h:75
#define ICLIO_API
Definition: CompatMacros.h:176
Definition: DCDevice.h:190
dc1394camera_t * m_poCam
associated camera (libdc stays the owner of the pointer)
Definition: DCDevice.h:179
Internally spawned thread class to provide continuous grabbing without drop frames.
Definition: DCGrabberThread.h:90
Device struct, used by the DCGrabber class to identify devices.
Definition: DCDevice.h:49
dc1394framerate_t framerate
corresponding framerate;
Definition: DCDevice.h:98
Mode getMode() const
returns the current mode
Definition: DCDevice.h:111
std::string getTypeID() const
returns an instances type ID (see also static functions)
Definition: DCDevice.h:60
BayerFilterMode
Definition: DCDevice.h:184
ICLQt_API void show(const icl::core::ImgBase &image)
shows an image using TestImages::show
Definition: DCDevice.h:189
bool operator!=(const Mode &m) const
compares to modes [!= complies !(==)]
Definition: DCDevice.h:104