Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TestPMDZess.cpp
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 /**
27  @file TestPMDZess.cpp
28  @brief Test VideoSource_PMDZess
29  @relates VideoSource_PMDZess
30  @ingroup g_tests
31  @author MIP
32 */
33 
34 
35 #include <VideoSource/VideoSource_PMDZess.hh>
36 #include <Base/Image/ImageIO.hh>
37 
38 #include <sstream>
39 
40 using namespace std;
41 using namespace BIAS;
42 
43 int main(int argc, char** argv)
44 {
46 
47  cam.SetBitFile("C:/Programme/z2D3D/Bitfiles/AchtBitExt.rbt");
48 
49  if (cam.OpenDevice() < 0) {
50  BIASERR("Error initializing camera!!!");
51  abort();
52  }
53  float shutter = 10.0;
54  if (cam.SetShutter(shutter) < 0) {
55  BIASERR("Error setting shutter!!!");
56  abort();
57  }
58  else
59  cerr<<"SetShutter: "<<shutter<<endl;
60 
61  cam.SetShutter2D(30.0);
62  cerr<<"SetShutter2D: 30.0"<<endl;
63 
64  shutter = cam.GetShutter();
65  cerr<<"GetShutter:"<<shutter<<endl;
66  shutter = cam.GetShutter2D();
67  cerr<<"GetShutter2D:"<<shutter<<endl;
68 
70  Camera<float> depth, coeff;
71 
72  stringstream st("");
73 
74  int i=0;
75  while (i<10) {
76  i++;
77 
78  //if(cam.CaptureSinglePhase(grey)!=0){
79  // BIASERR("CaptureSinglePhase failed");
80  // return -1;
81  //}
82 
83  st << "temp" << i << ".mip";
84  if (cam.GrabSingle(grey) < 0) {
85  BIASERR("Grabbing went wrong!");
86  return -1;
87  }
88  if (cam.GrabSingleDepth(depth) < 0) {
89  BIASERR("No depthimage available!!!");
90  return -1;
91  }
92  if (cam.GrabSingleModCoeff(coeff) < 0) {
93  BIASERR("No depthimage available!!!");
94  return -1;
95  }
96  //ImageIO::Save(st.str(), grey);
97  ImageIO::Save(st.str(), grey);
98  st.str(string(""));
99  st << "tempDepth" << i << ".mip";
100  //ImageIO::Save(st.str(), depth);
101  ImageIO::Save(st.str(), depth);
102  st.str(string(""));
103  st << "tempCoeff" << i << ".mip";
104  //ImageIO::Save(st.str(), coeff);
105  ImageIO::Save(st.str(), coeff);
106  st.str(string(""));
107  }
108 
109  return 0;
110 }
represents Zess PMD camera driver interface TODO: include support for normal images (2DImg_)...
int SetShutter2D(float exptime)
Set shutter (exposure time) to exptime in seconds [==] for 2D-chip.
virtual float GetShutter()
Get shutter (exposure time) in seconds.
int GrabSingleDepth(Camera< float > &image)
Returns the depth image.
virtual int SetShutter(float exptime)
Set shutter (exposure time) in seconds.
virtual int OpenDevice()
selects the first available device to open (e.g.
void SetBitFile(std::string file)
virtual int GrabSingle(Camera< unsigned char > &image)
Returns the 2D image, and reads depth and modulation coefficients.
int GrabSingleModCoeff(Camera< float > &image)
Returns the amplitude image.