Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
VideoSource_MDcam.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003, 2004 (see file CONTACTS for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 #ifndef __VideoSource_MDCAM_HH__
26 #define __VideoSource_MDCAM_HH__
27 
28 #include <bias_config.h>
29 
30 #ifndef BIAS_HAVE_DCAM
31 # error You need DCAM for BIAS Videosource_MDCAM. Please recompile BIAS with USE_DCAM.
32 #endif // BIAS_HAVE_DCAM
33 
34 #ifdef WIN32
35 # error BIAS VideoSource_MDcam is unsupported on WIN32, currently. Please fix the code/buildsystem.
36 #endif // WIN32
37 
38 #include <string>
39 
40 #include <VideoSource/VideoSource_Base.hh>
41 #include <VideoSource/VideoSource_DCAM.hh>
42 #include <Base/Debug/Debug.hh>
43 #include <Base/Debug/Error.hh>
44 
45 #define D_MDCAM_INIT (1<<0)
46 #define D_MDCAM_GRAB (1<<2)
47 
48 namespace BIAS{
49  /**
50  \class VideoSource_MDcam
51  \ingroup g_videosource
52  \author evers
53  \brief VideoSource_MDcam simplifies acces to more then one DCam.
54  It suports multiple IEEE1394-adapters, extern synchronization via
55  parallel port and networked capture cluster.
56  */
57  class BIASVideoSource_EXPORT VideoSource_MDcam:public BIAS::Debug
58  {
59  public:
60  /*! Activates the timestamp for PointGrey Scorpion SCOR-20SO
61  */
62  void ActivateScorpionTimestamp();
63 
66 
67  void SetDebugLevelDcam(int d);
68 
69  int ScanBus(std::ofstream &ofs);
70 
71  int InitCameras(const std::string filename);
72  int ReleaseCameras();
73 
74  /// Call GrabSingle() with a prepared array of images to be filled
75  /** The size of the array MUST be the number of cameras
76  */
77  int GrabSingle(BIAS::Camera<unsigned char> *Image);
78 
79 #ifdef BUILD_IMAGE_USHORT
80  int GrabSingle(BIAS::Camera <unsigned short> *image);
81 #endif
82 
83  int PreGrab();
84 
85  int PostGrab();
86 
87  int SetFeature(dc1394feature_t feature, unsigned int value);
88  // int GetFeature( int feature);
89  int AutoMode( dc1394feature_t feature, dc1394feature_mode_t mode);
90 
91  int OnePushAuto(dc1394feature_t feature);
92 
93  int SetShutter(float exptime);
94  float GetShutter()
95  { return Camera_[0]->GetShutter(); }
96  int SetGain(float g);
97  float GetGain()
98  { return Camera_[0]->GetGain(); }
99 
100  inline void SetFps(float fps){Fps_ = fps;};
101  inline void SetBytesPerPixel(unsigned char b) {BytesPerPixel_ = b;};
102 
103  /** if on==true && active=true try to open parport at ParPort_,
104  if it fails, return -1
105  else set cameras to external trigger mode
106  if on==false set cameras to internal trigger mode
107  if active==true est cameras into external trigger mode but
108  ignore parport
109  */
110  int ExternalTrigger(bool on, bool active);
111 
112  /// Read @param feature from @param master and distributed it to all
113  int EqualizeFeature(int master, dc1394feature_t feature);
114 
115 
116  int SetCamera(CameraParameterSet camparam);
117 
118  int GetNumCams(){return NumCams_;};
119 
120  inline VideoSource_DCAM *GetCamera(int n) { return Camera_[n];};
121  inline int GetID(int i) {
122  if (i <NumCams_ ) return Camera_[i]->GetID();
123  else
124  return -1;
125 
126  };
127 
128 
129 
130 
131  protected:
132  float Fps_;
134  unsigned char BytesPerPixel_;
135 
137  int NumCams_;
140 
141  // Address of parport for external trigger
142  unsigned long ParPort_;
143 
144 
145 
146 
147 
148 
149  };
150 } // namespace MIP
151 
152 #endif
Stores the camera parameters such as Shutter, Gain, etc.
int BIASVideoSource_EXPORT ScanBus(std::stringstream &ofs)
support function to get the number of cameras and IDs of all cameras on one bus
This class VideoSource_DCAM implements access to IEEE1394 (Firewire, iLink) cameras following the DCa...
void SetBytesPerPixel(unsigned char b)
VideoSource_MDcam simplifies acces to more then one DCam. It suports multiple IEEE1394-adapters, extern synchronization via parallel port and networked capture cluster.
The image template class for specific storage types.
Definition: Image.hh:78
VideoSource_DCAM * GetCamera(int n)
VideoSource_DCAM ** Camera_