Loading...
Searching...
No Matches
harris_6d.h
/*
* Software License Agreement (BSD License)
*
* Copyright (c) 2010, 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 Willow Garage, Inc. 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.
*
* @author Suat Gedikli
*/
#pragma once
#include <pcl/keypoints/keypoint.h>
namespace pcl
{
/** \brief Keypoint detector for detecting corners in 3D (XYZ), 2D (intensity) AND mixed versions of these.
* \author Suat Gedikli
* \ingroup keypoints
*/
template <typename PointInT, typename PointOutT, typename NormalT = pcl::Normal>
class HarrisKeypoint6D : public Keypoint<PointInT, PointOutT>
{
public:
using Ptr = shared_ptr<HarrisKeypoint6D<PointInT, PointOutT, NormalT> >;
using ConstPtr = shared_ptr<const HarrisKeypoint6D<PointInT, PointOutT, NormalT> >;
using PointCloudIn = typename Keypoint<PointInT, PointOutT>::PointCloudIn;
using PointCloudOut = typename Keypoint<PointInT, PointOutT>::PointCloudOut;
using KdTree = typename Keypoint<PointInT, PointOutT>::KdTree;
using PointCloudInConstPtr = typename PointCloudIn::ConstPtr;
using Keypoint<PointInT, PointOutT>::name_;
using Keypoint<PointInT, PointOutT>::input_;
using Keypoint<PointInT, PointOutT>::indices_;
using Keypoint<PointInT, PointOutT>::surface_;
using Keypoint<PointInT, PointOutT>::tree_;
using Keypoint<PointInT, PointOutT>::k_;
using Keypoint<PointInT, PointOutT>::search_radius_;
using Keypoint<PointInT, PointOutT>::search_parameter_;
using Keypoint<PointInT, PointOutT>::keypoints_indices_;
/**
* @brief Constructor
* @param radius the radius for normal estimation as well as for non maxima suppression
* @param threshold the threshold to filter out weak corners
*/
HarrisKeypoint6D (float radius = 0.01, float threshold = 0.0)
: threshold_ (threshold)
,
normals_ (new pcl::PointCloud<NormalT>)
, intensity_gradients_ (new pcl::PointCloud<pcl::IntensityGradient>)
{
name_ = "HarrisKeypoint6D";
search_radius_ = radius;
}
/** \brief Empty destructor */
virtual ~HarrisKeypoint6D () = default;
/**
* @brief set the radius for normal estimation and non maxima suppression.
* @param radius
*/
void setRadius (float radius);
/**
* @brief set the threshold value for detecting corners. This is only evaluated if non maxima suppression is turned on.
* @brief note non maxima suppression needs to be activated in order to use this feature.
* @param threshold
*/
void setThreshold (float threshold);
/**
* @brief whether non maxima suppression should be applied or the response for each point should be returned
* @note this value needs to be turned on in order to apply thresholding and refinement
* @param nonmax default is false
*/
void setNonMaxSupression (bool = false);
/**
* @brief whether the detected key points should be refined or not. If turned of, the key points are a subset of the original point cloud. Otherwise the key points may be arbitrary.
* @brief note non maxima suppression needs to be on in order to use this feature.
* @param do_refine
*/
void setRefine (bool do_refine);
virtual void
setSearchSurface (const PointCloudInConstPtr &cloud) { surface_ = cloud; normals_->clear (); intensity_gradients_->clear ();}
/** \brief Initialize the scheduler and set the number of threads to use.
* \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
*/
inline void
setNumberOfThreads (unsigned int nr_threads = 0) { threads_ = nr_threads; }
protected:
void detectKeypoints (PointCloudOut &output);
void responseTomasi (PointCloudOut &output) const;
void refineCorners (PointCloudOut &corners) const;
void calculateCombinedCovar (const pcl::Indices& neighbors, float* coefficients) const;
private:
float threshold_;
bool refine_{true};
bool nonmax_{true};
unsigned int threads_{0};
typename pcl::PointCloud<NormalT>::Ptr normals_;
pcl::PointCloud<pcl::IntensityGradient>::Ptr intensity_gradients_;
} ;
}
#include <pcl/keypoints/impl/harris_6d.hpp>
pcl::HarrisKeypoint6D::PointCloudIn
typename Keypoint< PointInT, PointOutT >::PointCloudIn PointCloudIn
Definition harris_6d.h:55
pcl::HarrisKeypoint6D::setNonMaxSupression
void setNonMaxSupression(bool=false)
whether non maxima suppression should be applied or the response for each point should be returned
Definition harris_6d.hpp:68
pcl::HarrisKeypoint6D::ConstPtr
shared_ptr< const HarrisKeypoint6D< PointInT, PointOutT, NormalT > > ConstPtr
Definition harris_6d.h:53
pcl::HarrisKeypoint6D::setThreshold
void setThreshold(float threshold)
set the threshold value for detecting corners.
Definition harris_6d.hpp:50
pcl::HarrisKeypoint6D::setRefine
void setRefine(bool do_refine)
whether the detected key points should be refined or not.
Definition harris_6d.hpp:62
pcl::HarrisKeypoint6D::setRadius
void setRadius(float radius)
set the radius for normal estimation and non maxima suppression.
Definition harris_6d.hpp:56
pcl::HarrisKeypoint6D::responseTomasi
void responseTomasi(PointCloudOut &output) const
Definition harris_6d.hpp:267
pcl::HarrisKeypoint6D::setNumberOfThreads
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
Definition harris_6d.h:122
pcl::HarrisKeypoint6D::PointCloudInConstPtr
typename PointCloudIn::ConstPtr PointCloudInConstPtr
Definition harris_6d.h:58
pcl::HarrisKeypoint6D::detectKeypoints
void detectKeypoints(PointCloudOut &output)
Abstract key point detection method.
Definition harris_6d.hpp:142
pcl::HarrisKeypoint6D::PointCloudOut
typename Keypoint< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition harris_6d.h:56
pcl::HarrisKeypoint6D::refineCorners
void refineCorners(PointCloudOut &corners) const
Definition harris_6d.hpp:357
pcl::HarrisKeypoint6D::KdTree
typename Keypoint< PointInT, PointOutT >::KdTree KdTree
Definition harris_6d.h:57
pcl::HarrisKeypoint6D::Ptr
shared_ptr< HarrisKeypoint6D< PointInT, PointOutT, NormalT > > Ptr
Definition harris_6d.h:52
pcl::HarrisKeypoint6D::~HarrisKeypoint6D
virtual ~HarrisKeypoint6D()=default
Empty destructor.
pcl::HarrisKeypoint6D::HarrisKeypoint6D
HarrisKeypoint6D(float radius=0.01, float threshold=0.0)
Constructor.
Definition harris_6d.h:75
pcl::HarrisKeypoint6D::setSearchSurface
virtual void setSearchSurface(const PointCloudInConstPtr &cloud)
Provide a pointer to the input dataset that we need to estimate features at every point for.
Definition harris_6d.h:116
pcl::HarrisKeypoint6D::calculateCombinedCovar
void calculateCombinedCovar(const pcl::Indices &neighbors, float *coefficients) const
Definition harris_6d.hpp:75
pcl::PointCloudOut
pcl::Keypoint< PointInT, PointOutT >::Keypoint
Keypoint()=default
pcl::Keypoint< PointInT, PointOutT >::k_
int k_
Definition keypoint.h:188
pcl::Keypoint< PointInT, PointOutT >::name_
std::string name_
Definition keypoint.h:167
pcl::Keypoint::PointCloudIn
pcl::PointCloud< PointInT > PointCloudIn
Definition keypoint.h:66
pcl::Keypoint< PointInT, PointOutT >::search_parameter_
double search_parameter_
Definition keypoint.h:182
pcl::Keypoint< PointInT, PointOutT >::keypoints_indices_
pcl::PointIndicesPtr keypoints_indices_
Definition keypoint.h:191
pcl::Keypoint::PointCloudOut
pcl::PointCloud< PointOutT > PointCloudOut
Definition keypoint.h:69
pcl::Keypoint< PointInT, PointOutT >::tree_
KdTreePtr tree_
Definition keypoint.h:179
pcl::Keypoint< PointInT, PointOutT >::surface_
PointCloudInConstPtr surface_
Definition keypoint.h:176
pcl::Keypoint< PointInT, PointOutT >::search_radius_
double search_radius_
Definition keypoint.h:185
pcl::Keypoint::KdTree
pcl::search::Search< PointInT > KdTree
Definition keypoint.h:64
pcl::PCLBase< PointInT >::input_
PointCloudConstPtr input_
Definition pcl_base.h:147
pcl::PCLBase< PointInT >::indices_
IndicesPtr indices_
Definition pcl_base.h:150
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition point_cloud.h:174
pcl::PointCloud::Ptr
shared_ptr< PointCloud< PointT > > Ptr
Definition point_cloud.h:414
pcl
Definition convolution.h:46
pcl::Indices
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition types.h:133
pcl::IntensityGradient
A point structure representing the intensity gradient of an XYZI point cloud.
Definition point_types.hpp:1575