Point Cloud Library (PCL)  1.8.1
digital_elevation_map.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 #ifndef PCL_DIGITAL_ELEVATION_MAP_H_
37 #define PCL_DIGITAL_ELEVATION_MAP_H_
38 
39 #include <pcl/point_types.h>
40 #include <pcl/stereo/disparity_map_converter.h>
41 
42 namespace pcl
43 {
44  /** \brief Build a Digital Elevation Map in the column-disparity space from a disparity map and a color image of the scene.
45  *
46  * Example of usage:
47  *
48  * \code
49  * pcl::PointCloud<pcl::PointDEM>::Ptr cloud (new
50  * pcl::PointCloud<pcl::PointDEM>);
51  * pcl::PointCloud<pcl::RGB>::Ptr left_image (new
52  * pcl::PointCloud<pcl::RGB>);
53  * // Fill left image cloud.
54  *
55  * pcl::DigitalElevationMapBuilder demb;
56  * demb.setBaseline (0.8387445f);
57  * demb.setFocalLength (368.534700f);
58  * demb.setImageCenterX (318.112200f);
59  * demb.setImageCenterY (224.334900f);
60  * demb.setDisparityThresholdMin (15.0f);
61  * demb.setDisparityThresholdMax (80.0f);
62  * demb.setResolution (64, 32);
63  *
64  * // Left view of the scene.
65  * demb.loadImage (left_image);
66  * // Disparity map of the scene.
67  * demb.loadDisparityMap ("disparity_map.txt", 640, 480);
68  *
69  * demb.compute(*cloud);
70  * \endcode
71  *
72  * \author Timur Ibadov (ibadov.timur@gmail.com)
73  * \ingroup stereo
74  */
75  class PCL_EXPORTS DigitalElevationMapBuilder : public DisparityMapConverter <PointDEM>
76  {
77  public:
86 
87  /** \brief DigitalElevationMapBuilder constructor. */
89  /** \brief Empty destructor. */
90  virtual ~DigitalElevationMapBuilder ();
91 
92  /** \brief Set resolution of the DEM.
93  * \param[in] resolution_column the column resolution.
94  * \param[in] resolution_disparity the disparity resolution.
95  */
96  void
97  setResolution (size_t resolution_column, size_t resolution_disparity);
98 
99  /** \brief Get column resolution of the DEM.
100  * \return column resolution of the DEM.
101  */
102  size_t
103  getColumnResolution () const;
104 
105  /** \brief Get disparity resolution of the DEM.
106  * \return disparity resolution of the DEM.
107  */
108  size_t
109  getDisparityResolution () const;
110 
111  /** \brief Set minimum amount of points in a DEM's cell.
112  * \param[in] min_points_in_cell minimum amount of points in a DEM's cell.
113  */
114  void
115  setMinPointsInCell (size_t min_points_in_cell);
116 
117  /** \brief Get minimum amount of points in a DEM's cell.
118  * \return minimum amount of points in a DEM's cell.
119  */
120  size_t
121  getMinPointsInCell () const;
122 
123  /** \brief Compute the Digital Elevation Map.
124  * \param[out] out_cloud the variable to return the resulting cloud.
125  */
126  void
127  compute (pcl::PointCloud<PointDEM> &out_cloud);
128 
129  protected:
130  /** \brief Column resolution of the DEM. */
132  /** \brief disparity resolution of the DEM. */
134 
135  /** \brief Minimum amount of points in a DEM's cell. */
137  };
138 }
139 
140 #endif // PCL_DIGITAL_ELEVATION_MAP_H_
size_t resolution_column_
Column resolution of the DEM.
size_t min_points_in_cell_
Minimum amount of points in a DEM&#39;s cell.
Defines all the PCL implemented PointT point type structures.
Compute point cloud from the disparity map.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
Build a Digital Elevation Map in the column-disparity space from a disparity map and a color image of...
size_t resolution_disparity_
disparity resolution of the DEM.