Point Cloud Library (PCL)  1.8.0
depth_sense_grabber.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2014-, Open Perception, Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of the copyright holder(s) nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
38 #ifndef PCL_IO_DEPTH_SENSE_GRABBER_H
39 #define PCL_IO_DEPTH_SENSE_GRABBER_H
40 
41 #include <pcl/io/grabber.h>
42 #include <pcl/point_cloud.h>
43 #include <pcl/point_types.h>
44 
45 namespace pcl
46 {
47 
48  // Forward declaration of a class that contains actual grabber implementation
49  namespace io { namespace depth_sense { struct DepthSenseGrabberImpl; } }
50 
51  /** Grabber for DepthSense devices (e.g. Creative Senz3D, SoftKinetic DS325).
52  *
53  * Requires [SoftKinetic DepthSense SDK](http://www.softkinetic.com/Support/Download).
54  *
55  * \author Sergey Alexandrov
56  * \ingroup io */
57  class PCL_EXPORTS DepthSenseGrabber : public Grabber
58  {
59 
60  public:
61 
62  typedef
63  void (sig_cb_depth_sense_point_cloud)
65 
66  typedef
67  void (sig_cb_depth_sense_point_cloud_rgba)
69 
70  enum Mode
71  {
72  DepthSense_QVGA_30Hz = 0,
73  };
74 
76  {
77  DepthSense_None = 0,
78  DepthSense_Median = 1,
79  DepthSense_Average = 2,
80  };
81 
82  /** Create a grabber for a DepthSense device.
83  *
84  * The grabber "captures" the device, making it impossible for other
85  * grabbers to interact with it. The device is "released" when the
86  * grabber is destructed.
87  *
88  * This will throw pcl::IOException if there are no free devices that
89  * match the supplied \a device_id.
90  *
91  * \param[in] device_id device identifier, which might be a serial
92  * number, an index (with '#' prefix), or an empty string (to select the
93  * first available device)
94  */
95  DepthSenseGrabber (const std::string& device_id = "");
96 
97  virtual
98  ~DepthSenseGrabber () throw ();
99 
100  virtual void
101  start ();
102 
103  virtual void
104  stop ();
105 
106  virtual bool
107  isRunning () const;
108 
109  virtual std::string
110  getName () const
111  {
112  return (std::string ("DepthSenseGrabber"));
113  }
114 
115  virtual float
116  getFramesPerSecond () const;
117 
118  /** Set the confidence threshold for depth data.
119  *
120  * Each pixel in a depth image output by the device has an associated
121  * confidence value. The higher this value is, the more reliable the
122  * datum is.
123  *
124  * The depth pixels (and their associated 3D points) are filtered based
125  * on the confidence value. Those that are below the threshold are
126  * discarded (i.e. their coordinates are set to NaN). */
127  void
128  setConfidenceThreshold (int threshold);
129 
130  /** Enable temporal filtering of the depth data received from the device.
131  *
132  * The window size parameter is not relevant for `DepthSense_None`
133  * filtering type. */
134  void
135  enableTemporalFiltering (TemporalFilteringType type, size_t window_size = 1);
136 
137  /** Disable temporal filtering. */
138  void
139  disableTemporalFiltering ();
140 
141  /** Get the serial number of device captured by the grabber. */
142  std::string
143  getDeviceSerialNumber () const;
144 
145  private:
146 
149 
150  };
151 
152 }
153 
154 #endif /* PCL_IO_DEPTH_SENSE_GRABBER_H */
155 
Grabber for DepthSense devices (e.g.
Grabber interface for PCL 1.x device drivers.
Definition: grabber.h:58
Defines all the PCL implemented PointT point type structures.
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:429