Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
VideoSource_DcamPMD.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT 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 
26 #ifndef __BIASVIDEOSOURCE_DCAMPMD_HH__
27 #define __BIASVIDEOSOURCE_DCAMPMD_HH__
28 
29 #ifndef WIN32
30 # error The PMD-camera can only be run under windows.
31 #endif
32 
33 #include <pmdmsdk.h>
34 #include <VideoSource/VideoSource_Base.hh>
35 #include <Image/Camera.hh>
36 #include <bias_config.h>
37 #include <vector>
38 #include <Image/PMDImageProc.hh>
39 
40 /* no longer in use -- timemeasure instead
41 #include <sys/time.h>
42 */
43 
44 namespace BIAS {
45 
46  /** @class VideoSource_DcamPMD
47  @ingroup g_videosource
48  @brief reads PMD-tiffs with depth images and modulation coefficients
49  @author streckel 05/2006
50  */
51  class BIASVideoSource_EXPORT VideoSource_DcamPMD : public VideoSource {
52 
53  public:
55 
57 
58  virtual int OpenDevice();
59  virtual int CloseDevice();
60 
61  virtual int PreGrab();
62  virtual int PostGrab();
63 
64 
65  /** Returns current framerate
66  */
67  double GetFPS();
68 
69  virtual int InitImage(ImageBase &img);
70 
71 
72  /** Returns the 2D image, and reads depth and modulation coefficients */
73  virtual int GrabSingle(Camera<unsigned char> &image);
74 
75  /// Set shutter (exposure time) to exptime in seconds
76  virtual int SetShutter(float exptime);
77 
78  /// Set gain to g with g[dB]
79  virtual int SetGain(float g);
80 
81  virtual float GetShutter();
82  virtual float GetGain();
83 
84  /* Set the integration time in us */
85  int SetIntegrationTime(int dIntegrationTime);
86  /* Get the integration time in us */
87  int GetIntegrationTime();
88  /* Set the Modulation frequency*/
89  int SetModulationFrequency(int dModulationFrequency);
90  /* Get the Modulation frequency*/
91  int GetModulationFrequency();
92 
93  /** Returns the depth image. Must be called after GrabSingle() */
94  inline int GrabSingleDepth(Camera<float> &image)
95  {
96  if (!DepthImg_.IsEmpty()) {
97  image = DepthImg_;
98  return 0;
99  }
100  return -1;
101  }
102 
103  /** Returns the amplitude image. Must be called after GrabSingle() */
105  {
106  if (!ModCoeffImg_.IsEmpty()) {
107  image = ModCoeffImg_;
108  return 0;
109  }
110  return -1;
111  }
112 
113  void SetGenerateNewUIDs(bool s) {
114  BIASERR("Always generating new UUIDS for PMD images");
115  BIASABORT;
116  }
117 
118  protected:
119  PMDHandle handle_;
120 
121  //BIAS::Camera<unsigned char> 2DImg_;
123  PMDPixelOrigin pixori_;
124 
125  void ImageUcharFromDouble_(double* data, Image<unsigned char> &dst);
126  void ImageFloatFromDouble_(double* data, Image<float> &dst);
127 
128  };
129 
130 } // namespace BIAS
131 
132 #endif
Defines a common interface to different devices.
int GrabSingleDepth(Camera< float > &image)
Returns the depth image.
int GrabSingleModCoeff(Camera< float > &image)
Returns the amplitude image.
BIAS::Camera< float > ModCoeffImg_
reads PMD-tiffs with depth images and modulation coefficients
This is the base class for images in BIAS.
Definition: ImageBase.hh:102