Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
VideoSource_DiskPMD.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_DISKPMD_HH__
27 #define __BIASVIDEOSOURCE_DISKPMD_HH__
28 
29 #include <VideoSource/VideoSource_Disk.hh>
30 #include <Image/Camera.hh>
31 #include <bias_config.h>
32 #include <vector>
33 #include <Image/PMDImageProc.hh>
34 #include <Base/Image/PMDImageIO.hh>
35 
36 /* no longer in use -- timemeasure instead
37 #include <sys/time.h>
38 */
39 
40 namespace BIAS {
41 
42  /** @class VideoSource_DiskPMD
43  @ingroup g_videosource
44  @brief reads PMD-tiffs with depth images and modulation coefficients
45  @author streckel 05/2006 */
46  class BIASVideoSource_EXPORT VideoSource_DiskPMD : public VideoSource_Disk {
47 
48  public:
50 
51  virtual ~VideoSource_DiskPMD();
52 
53 #ifdef BIAS_HAVE_XML2
54  /** Read the images from an XML-file containing a whole image sequence.
55  */
56  virtual int OpenDevice(std::string &FileNames);
57 #endif
58 
59  /** The filenames vector should contain the names of PMD-TIFFS
60  */
61  virtual int OpenDevice(const std::vector<std::string> &FileNames);
62 
63  virtual int OpenDevice();
64 
65  /** Returns the 2D image, and reads depth and modulation coefficients */
66  virtual int GrabSingle(Camera<unsigned char> &image);
67 
68  /** Returns the depth image. Must be called after GrabSingle() */
69  inline int GrabSingleDepth(Camera<float> &image)
70  {
71  if (!DepthImg_.IsEmpty()) {
72  image = DepthImg_;
73  return 0;
74  }
75  return -1;
76  }
77 
78  /** Returns the depth image. Must be called after GrabSingle() */
79  inline int GrabSingleModCoeff(Camera<float> &image)
80  {
81  if (!ModCoeffImg_.IsEmpty()) {
82  image = ModCoeffImg_;
83  return 0;
84  }
85  return -1;
86  }
87 
88  void SetGenerateNewUIDs(bool s) {
89  BIASERR("Always generating new UUIDS for PMD images");
90  BIASABORT;
91  }
92 
93  protected:
95 
96 #ifdef BIAS_HAVE_XML2
97  std::vector<Image<unsigned char> > vecImg2D_;
98  std::vector<Image<float> > vecImgDepth_;
99  std::vector<Image<float> > vecImgModCoeff_;
100  std::vector<PMDImageMetaData> vecMetaData2D_;
101  std::vector<PMDImageMetaData> vecMetaDataDepth_;
102 #endif
103 
104  //BIAS::Camera<unsigned char> 2DImg_;
106 
107 
108  };
109 
110 } // namespace BIAS
111 
112 #endif
std::vector< Image< unsigned char > > vecImg2D_
std::vector< Image< float > > vecImgDepth_
int GrabSingleModCoeff(Camera< float > &image)
Returns the depth image.
std::vector< PMDImageMetaData > vecMetaData2D_
reads PMD-tiffs with depth images and modulation coefficients
std::vector< PMDImageMetaData > vecMetaDataDepth_
std::vector< Image< float > > vecImgModCoeff_
int GrabSingleDepth(Camera< float > &image)
Returns the depth image.
BIAS::Camera< float > ModCoeffImg_
This class simulates a video device by loading images from disk.