shadowpoints.h
/*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2009-2011, Willow Garage, 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.
*
*/
#pragma once
#include <pcl/filters/filter_indices.h>
namespace pcl
{
/** \brief @b ShadowPoints removes the ghost points appearing on edge discontinuties
*
* \author Aravindhan K Krishnan. This code is ported from libpointmatcher (https://github.com/ethz-asl/libpointmatcher)
* \ingroup filters
*/
template<typename PointT, typename NormalT>
class ShadowPoints : public FilterIndices<PointT>
{
using FilterIndices<PointT>::filter_name_;
using FilterIndices<PointT>::getClassName;
using FilterIndices<PointT>::indices_;
using FilterIndices<PointT>::input_;
using FilterIndices<PointT>::removed_indices_;
using FilterIndices<PointT>::extract_removed_indices_;
using FilterIndices<PointT>::negative_;
using FilterIndices<PointT>::user_filter_value_;
using FilterIndices<PointT>::keep_organized_;
using PointCloud = typename FilterIndices<PointT>::PointCloud;
using PointCloudPtr = typename PointCloud::Ptr;
using PointCloudConstPtr = typename PointCloud::ConstPtr;
using NormalsPtr = typename pcl::PointCloud<NormalT>::Ptr;
public:
using Ptr = shared_ptr< ShadowPoints<PointT, NormalT> >;
using ConstPtr = shared_ptr< const ShadowPoints<PointT, NormalT> >;
/** \brief Empty constructor. */
ShadowPoints (bool extract_removed_indices = false) :
FilterIndices<PointT> (extract_removed_indices),
input_normals_ (),
threshold_ (0.1f)
{
filter_name_ = "ShadowPoints";
}
/** \brief Set the normals computed on the input point cloud
* \param[in] normals the normals computed for the input cloud
*/
inline void
setNormals (const NormalsPtr &normals) { input_normals_ = normals; }
/** \brief Get the normals computed on the input point cloud */
inline NormalsPtr
getNormals () const { return (input_normals_); }
/** \brief Set the threshold for shadow points rejection
* \param[in] threshold the threshold
*/
inline void
setThreshold (float threshold) { threshold_ = threshold; }
/** \brief Get the threshold for shadow points rejection */
inline float
getThreshold () const { return threshold_; }
protected:
/** \brief The normals computed at each point in the input cloud */
NormalsPtr input_normals_;
/** \brief Sample of point indices into a separate PointCloud
* \param[out] output the resultant point cloud
*/
void
applyFilter (PointCloud &output) override;
/** \brief Sample of point indices
* \param[out] indices the resultant point cloud indices
*/
void
applyFilter (Indices &indices) override;
private:
/** \brief Threshold for shadow point rejection
*/
float threshold_;
};
}
#ifdef PCL_NO_PRECOMPILE
#include <pcl/filters/impl/shadowpoints.hpp>
#endif
pcl::Filter::Ptr
shared_ptr< Filter< PointT > > Ptr
Definition: filter.h:83
pcl::Filter::ConstPtr
shared_ptr< const Filter< PointT > > ConstPtr
Definition: filter.h:84
pcl::Filter::filter_name_
std::string filter_name_
The filter name.
Definition: filter.h:158
pcl::FilterIndices
FilterIndices represents the base class for filters that are about binary point removal.
Definition: filter_indices.h:75
pcl::PCLBase::PointCloudPtr
typename PointCloud::Ptr PointCloudPtr
Definition: pcl_base.h:73
pcl::PCLBase::PointCloudConstPtr
typename PointCloud::ConstPtr PointCloudConstPtr
Definition: pcl_base.h:74
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition: point_cloud.h:173
pcl::PointCloud::Ptr
shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:413
pcl::PointCloud::ConstPtr
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:414
pcl::ShadowPoints
ShadowPoints removes the ghost points appearing on edge discontinuties
Definition: shadowpoints.h:51
pcl::ShadowPoints::setNormals
void setNormals(const NormalsPtr &normals)
Set the normals computed on the input point cloud.
Definition: shadowpoints.h:85
pcl::ShadowPoints::input_normals_
NormalsPtr input_normals_
The normals computed at each point in the input cloud.
Definition: shadowpoints.h:104
pcl::ShadowPoints::getNormals
NormalsPtr getNormals() const
Get the normals computed on the input point cloud.
Definition: shadowpoints.h:89
pcl::ShadowPoints::getThreshold
float getThreshold() const
Get the threshold for shadow points rejection.
Definition: shadowpoints.h:99
pcl::ShadowPoints::applyFilter
void applyFilter(PointCloud &output) override
Sample of point indices into a separate PointCloud.
Definition: shadowpoints.hpp:47
pcl::ShadowPoints::setThreshold
void setThreshold(float threshold)
Set the threshold for shadow points rejection.
Definition: shadowpoints.h:95
pcl::ShadowPoints::ShadowPoints
ShadowPoints(bool extract_removed_indices=false)
Empty constructor.
Definition: shadowpoints.h:73
pcl
Definition: convolution.h:46
pcl::Indices
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition: types.h:133
pcl::PointXYZRGB
A point structure representing Euclidean xyz coordinates, and the RGB color.
Definition: point_types.hpp:675