Point Cloud Library (PCL)  1.14.1-dev
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 #pragma once
39 
40 #include <pcl/io/grabber.h>
41 #include <pcl/point_cloud.h>
42 #include <pcl/point_types.h>
43 
44 namespace pcl
45 {
46 
47  // Forward declaration of a class that contains actual grabber implementation
48  namespace io { namespace depth_sense { struct DepthSenseGrabberImpl; } }
49 
50  /** Grabber for DepthSense devices (e.g. Creative Senz3D, SoftKinetic DS325).
51  *
52  * Requires [SoftKinetic DepthSense SDK](http://www.softkinetic.com/Support/Download).
53  *
54  * \author Sergey Alexandrov
55  * \ingroup io */
57  {
58 
59  public:
60 
61  using Ptr = shared_ptr<DepthSenseGrabber>;
62  using ConstPtr = shared_ptr<const DepthSenseGrabber>;
63 
66 
67  enum Mode
68  {
69  DepthSense_QVGA_30Hz = 0,
70  };
71 
73  {
74  DepthSense_None = 0,
75  DepthSense_Median = 1,
76  DepthSense_Average = 2,
77  };
78 
79  /** Create a grabber for a DepthSense device.
80  *
81  * The grabber "captures" the device, making it impossible for other
82  * grabbers to interact with it. The device is "released" when the
83  * grabber is destructed.
84  *
85  * This will throw pcl::IOException if there are no free devices that
86  * match the supplied \a device_id.
87  *
88  * \param[in] device_id device identifier, which might be a serial
89  * number, an index (with '#' prefix), or an empty string (to select the
90  * first available device)
91  */
92  DepthSenseGrabber (const std::string& device_id = "");
93 
94  virtual
95  ~DepthSenseGrabber () noexcept;
96 
97  virtual void
98  start ();
99 
100  virtual void
101  stop ();
102 
103  virtual bool
104  isRunning () const;
105 
106  virtual std::string
107  getName () const
108  {
109  return (std::string ("DepthSenseGrabber"));
110  }
111 
112  virtual float
114 
115  /** Set the confidence threshold for depth data.
116  *
117  * Each pixel in a depth image output by the device has an associated
118  * confidence value. The higher this value is, the more reliable the
119  * datum is.
120  *
121  * The depth pixels (and their associated 3D points) are filtered based
122  * on the confidence value. Those that are below the threshold are
123  * discarded (i.e. their coordinates are set to NaN). */
124  void
125  setConfidenceThreshold (int threshold);
126 
127  /** Enable temporal filtering of the depth data received from the device.
128  *
129  * The window size parameter is not relevant for `DepthSense_None`
130  * filtering type. */
131  void
132  enableTemporalFiltering (TemporalFilteringType type, std::size_t window_size = 1);
133 
134  /** Disable temporal filtering. */
135  void
137 
138  /** Get the serial number of device captured by the grabber. */
139  std::string
141 
142  private:
143 
146 
147  };
148 
149 }
Grabber for DepthSense devices (e.g.
void enableTemporalFiltering(TemporalFilteringType type, std::size_t window_size=1)
Enable temporal filtering of the depth data received from the device.
virtual ~DepthSenseGrabber() noexcept
void(const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &) sig_cb_depth_sense_point_cloud
void disableTemporalFiltering()
Disable temporal filtering.
void setConfidenceThreshold(int threshold)
Set the confidence threshold for depth data.
shared_ptr< DepthSenseGrabber > Ptr
DepthSenseGrabber(const std::string &device_id="")
Create a grabber for a DepthSense device.
virtual float getFramesPerSecond() const
returns fps.
std::string getDeviceSerialNumber() const
Get the serial number of device captured by the grabber.
void(const pcl::PointCloud< pcl::PointXYZRGBA >::ConstPtr &) sig_cb_depth_sense_point_cloud_rgba
shared_ptr< const DepthSenseGrabber > ConstPtr
Grabber interface for PCL 1.x device drivers.
Definition: grabber.h:60
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:414
Defines all the PCL implemented PointT point type structures.
#define PCL_EXPORTS
Definition: pcl_macros.h:325