Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
VideoSource_Kinect_Base.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_KINECT_BASE_HH_
26 #define VIDEOSOURCE_KINECT_BASE_HH_
27 
28 #include <VideoSource/VideoSource_Base.hh>
29 #include <Image/Camera.hh>
30 
31 namespace BIAS {
32 
33  /**
34  * Use Kinect just like the ToF Cameras. There is no parameters to control the camera yet.
35  * Functionally might be added later depending on evolution of libfreenect
36  * @author fkellner 02/11
37  */
38  class BIASVideoSource_EXPORT VideoSource_Kinect_Base : public VideoSource {
39  public:
40 
41  enum CaptureMode {
42  DepthRay=0,
44  DepthRaw
45  };
46 
47  /// Opens first device found, OpenDevice(0)
48  virtual int OpenDevice() = 0;
49 
50  /// Opens device by id. On first call inits the context and looks for available cameras (i.e. scan bus)
51  virtual int OpenDevice(int device) = 0;
52 
53  /// Close device, if no other kinect cameras are in use, context is deleted (i.e. close usb bus connection)
54  virtual int CloseDevice() = 0;
55 
56  /// set appropriate operation mode for kinect and start grabbing thread (see callbacks in VideoSource_Kinect_Callback)
57  virtual int PreGrab() = 0;
58  /// stop grabbing thread
59  virtual int PostGrab() = 0;
60 
61  /// kinect color image will be 640x480, RGB.
62  virtual int InitImage(BIAS::ImageBase &Image) = 0;
63  /// kinect depth image will be 640x480, float in Millimeters
64  virtual int InitDepthImage(BIAS::ImageBase &Image) = 0;
65 
66  /// grab single color image
67  virtual int GrabSingle(BIAS::Camera <unsigned char> &image) = 0;
68  /// depth according to formula by Stephane Magnenat, see http://openkinect.org/wiki/Imaging_Information, todo: needs validation!
69  virtual int GrabSingleDepth(BIAS::Camera <float> &image) = 0;
70 
71  virtual int CreateDepthLookupTable(double px, double py, double fx, double fy) = 0;
72 
73  virtual int SetVideoModeColor() = 0;
74  virtual int SetVideoModeIR() = 0;
75 
76  virtual int SetDepthCaptureMode(CaptureMode mode) = 0;
77 
78  virtual int SetSwitchVideoModeAfterGrab() = 0;
79 
80  virtual int SetTilt(double degrees) = 0;
81  virtual int SetLed(int mode) = 0;
82  virtual int GetAccelerometer(double &tilt, double &x, double &y, double &z) = 0;
83 
84  virtual int GetNumDevices() = 0;
85 
86  virtual int GetCapabilities(VideoSourceCapabilities &caps) =0;
87  virtual int GetCapabilities(const char *device, VideoSourceCapabilities &caps) =0;
88 
89  virtual int ToggleDepthStream() = 0;
90  };
91 
92 }
93 
94 #endif /* VIDEOSOURCE_KINECT_BASE_HH_ */
Defines a common interface to different devices.
The image template class for specific storage types.
Definition: Image.hh:78
Checks for VideoSource capabilities.
Use Kinect just like the ToF Cameras.
This is the base class for images in BIAS.
Definition: ImageBase.hh:102