Point Cloud Library (PCL)  1.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
range_image_planar.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2010, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage, Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef PCL_RANGE_IMAGE_PLANAR_H_
36 #define PCL_RANGE_IMAGE_PLANAR_H_
37 
39 
40 namespace pcl
41 {
50  {
51  public:
52  // =====TYPEDEFS=====
54  typedef boost::shared_ptr<RangeImagePlanar> Ptr;
55  typedef boost::shared_ptr<const RangeImagePlanar> ConstPtr;
56 
57  // =====CONSTRUCTOR & DESTRUCTOR=====
62 
65  virtual RangeImage*
66  getNew () const { return new RangeImagePlanar; }
67 
68  // =====PUBLIC METHODS=====
70  inline Ptr
71  makeShared () { return Ptr (new RangeImagePlanar (*this)); }
72 
83  PCL_EXPORTS void
84  setDisparityImage (const float* disparity_image, int di_width, int di_height,
85  float focal_length, float base_line, float desired_angular_resolution=-1);
86 
99  PCL_EXPORTS void
100  setDepthImage (const float* depth_image, int di_width, int di_height, float di_center_x, float di_center_y,
101  float di_focal_length_x, float di_focal_length_y, float desired_angular_resolution=-1);
102 
115  PCL_EXPORTS void
116  setDepthImage (const unsigned short* depth_image, int di_width, int di_height, float di_center_x, float di_center_y,
117  float di_focal_length_x, float di_focal_length_y, float desired_angular_resolution=-1);
118 
132  template <typename PointCloudType> void
133  createFromPointCloudWithFixedSize (const PointCloudType& point_cloud,
134  int di_width, int di_height, float di_center_x, float di_center_y,
135  float di_focal_length_x, float di_focal_length_y,
136  const Eigen::Affine3f& sensor_pose,
137  CoordinateFrame coordinate_frame=CAMERA_FRAME, float noise_level=0.0f,
138  float min_range=0.0f);
139 
140  // Since we reimplement some of these overloaded functions, we have to do the following:
143 
151  virtual inline void
152  calculate3DPoint (float image_x, float image_y, float range, Eigen::Vector3f& point) const;
153 
161  virtual inline void
162  getImagePoint (const Eigen::Vector3f& point, float& image_x, float& image_y, float& range) const;
163 
177  PCL_EXPORTS virtual void
178  getSubImage (int sub_image_image_offset_x, int sub_image_image_offset_y, int sub_image_width,
179  int sub_image_height, int combine_pixels, RangeImage& sub_image) const;
180 
182  PCL_EXPORTS virtual void
183  getHalfImage (RangeImage& half_image) const;
184 
185  protected:
186  float focal_length_x_, focal_length_y_;
187  float focal_length_x_reciprocal_, focal_length_y_reciprocal_;
188  float center_x_, center_y_;
189  };
190 } // namespace end
191 
192 
193 #include <pcl/range_image/impl/range_image_planar.hpp> // Definitions of templated and inline functions
194 
195 #endif //#ifndef PCL_RANGE_IMAGE_H_