range_image_spherical.h
/*
* Software License Agreement (BSD License)
*
* Copyright (c) 2012-, Open Perception, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the copyright holder(s) nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PCL_RANGE_IMAGE_SPHERICAL_H_
#define PCL_RANGE_IMAGE_SPHERICAL_H_
#include <pcl/range_image/range_image.h>
namespace pcl
{
/** \brief @b RangeImageSpherical is derived from the original range image and uses a slightly different
* spherical projection. In the original range image, the image will appear more and more
* "scaled down" along the y axis, the further away from the mean line of the image a point is.
* This class removes this scaling, which makes it especially suitable for spinning LIDAR sensors
* that capure a 360° view, since a rotation of the sensor will now simply correspond to a shift of the
* range image. (This class is similar to RangeImagePlanar, but changes less of the behaviour of the base class.)
* \author Andreas Muetzel
* \ingroup range_image
*/
class RangeImageSpherical : public RangeImage
{
public:
// =====TYPEDEFS=====
typedef RangeImage BaseClass;
typedef boost::shared_ptr<RangeImageSpherical> Ptr;
typedef boost::shared_ptr<const RangeImageSpherical> ConstPtr;
// =====CONSTRUCTOR & DESTRUCTOR=====
/** Constructor */
PCL_EXPORTS RangeImageSpherical () {}
/** Destructor */
PCL_EXPORTS virtual ~RangeImageSpherical () {}
/** Return a newly created RangeImagePlanar.
* Reimplmentation to return an image of the same type. */
virtual RangeImage*
getNew () const { return new RangeImageSpherical; }
// =====PUBLIC METHODS=====
/** \brief Get a boost shared pointer of a copy of this */
inline Ptr
makeShared () { return Ptr (new RangeImageSpherical (*this)); }
// Since we reimplement some of these overloaded functions, we have to do the following:
using RangeImage::calculate3DPoint;
using RangeImage::getImagePoint;
/** \brief Calculate the 3D point according to the given image point and range
* \param image_x the x image position
* \param image_y the y image position
* \param range the range
* \param point the resulting 3D point
* \note Implementation according to planar range images (compared to spherical as in the original)
*/
virtual inline void
calculate3DPoint (float image_x, float image_y, float range, Eigen::Vector3f& point) const;
/** \brief Calculate the image point and range from the given 3D point
* \param point the resulting 3D point
* \param image_x the resulting x image position
* \param image_y the resulting y image position
* \param range the resulting range
* \note Implementation according to planar range images (compared to spherical as in the original)
*/
virtual inline void
getImagePoint (const Eigen::Vector3f& point, float& image_x, float& image_y, float& range) const;
/** Get the angles corresponding to the given image point */
inline void
getAnglesFromImagePoint (float image_x, float image_y, float& angle_x, float& angle_y) const;
/** Get the image point corresponding to the given ranges */
inline void
getImagePointFromAngles (float angle_x, float angle_y, float& image_x, float& image_y) const;
};
} // namespace end
#include <pcl/range_image/impl/range_image_spherical.hpp> // Definitions of templated and inline functions
#endif //#ifndef PCL_RANGE_IMAGE_SPHERICAL_H_
pcl::RangeImageSpherical::getImagePointFromAngles
void getImagePointFromAngles(float angle_x, float angle_y, float &image_x, float &image_y) const
Get the image point corresponding to the given ranges.
Definition: range_image_spherical.hpp:73
pcl::RangeImageSpherical::Ptr
boost::shared_ptr< RangeImageSpherical > Ptr
Definition: range_image_spherical.h:56
pcl::RangeImage
RangeImage is derived from pcl/PointCloud and provides functionalities with focus on situations where...
Definition: range_image.h:55
pcl
Definition: cloud_iterator.h:46
pcl::RangeImageSpherical
RangeImageSpherical is derived from the original range image and uses a slightly different spherical ...
Definition: range_image_spherical.h:51
pcl::RangeImageSpherical::ConstPtr
boost::shared_ptr< const RangeImageSpherical > ConstPtr
Definition: range_image_spherical.h:57
pcl::RangeImageSpherical::getAnglesFromImagePoint
void getAnglesFromImagePoint(float image_x, float image_y, float &angle_x, float &angle_y) const
Get the angles corresponding to the given image point.
Definition: range_image_spherical.hpp:66
pcl::RangeImage::getImagePoint
virtual void getImagePoint(const Eigen::Vector3f &point, float &image_x, float &image_y, float &range) const
Get imagePoint from 3D point in world coordinates.
Definition: range_image.hpp:352
pcl::RangeImageSpherical::RangeImageSpherical
PCL_EXPORTS RangeImageSpherical()
Constructor.
Definition: range_image_spherical.h:61
pcl::RangeImageSpherical::~RangeImageSpherical
virtual PCL_EXPORTS ~RangeImageSpherical()
Destructor.
Definition: range_image_spherical.h:63
pcl::RangeImage::calculate3DPoint
void calculate3DPoint(float image_x, float image_y, float range, PointWithRange &point) const
Calculate the 3D point according to the given image point and range.
Definition: range_image.hpp:585
pcl::RangeImageSpherical::BaseClass
RangeImage BaseClass
Definition: range_image_spherical.h:55
pcl::RangeImageSpherical::getNew
virtual RangeImage * getNew() const
Return a newly created RangeImagePlanar.
Definition: range_image_spherical.h:68
pcl::RangeImageSpherical::getImagePoint
virtual void getImagePoint(const Eigen::Vector3f &point, float &image_x, float &image_y, float &range) const
Calculate the image point and range from the given 3D point.
Definition: range_image_spherical.hpp:56
pcl::RangeImageSpherical::makeShared
Ptr makeShared()
Get a boost shared pointer of a copy of this.
Definition: range_image_spherical.h:73
pcl::RangeImageSpherical::calculate3DPoint
virtual void calculate3DPoint(float image_x, float image_y, float range, Eigen::Vector3f &point) const
Calculate the 3D point according to the given image point and range.
Definition: range_image_spherical.hpp:44