Point Cloud Library (PCL) 1.12.0
Loading...
Searching...
No Matches
intensity_gradient.h
1/*
2 * Software License Agreement (BSD License)
3 *
4 * Point Cloud Library (PCL) - www.pointclouds.org
5 * Copyright (c) 2010-2011, Willow Garage, Inc.
6 * Copyright (c) 2012-, Open Perception, Inc.
7 *
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * * Redistributions in binary form must reproduce the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer in the documentation and/or other materials provided
19 * with the distribution.
20 * * Neither the name of the copyright holder(s) nor the names of its
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 * $Id$
38 *
39 */
40
41#pragma once
42
43#include <pcl/features/feature.h>
44#include <pcl/common/intensity.h>
45
46namespace pcl
47{
48 /** \brief IntensityGradientEstimation estimates the intensity gradient for a point cloud that contains position
49 * and intensity values. The intensity gradient at a given point will be a vector orthogonal to the surface
50 * normal and pointing in the direction of the greatest increase in local intensity; the vector's magnitude
51 * indicates the rate of intensity change.
52 * \author Michael Dixon
53 * \ingroup features
54 */
55 template <typename PointInT, typename PointNT, typename PointOutT, typename IntensitySelectorT = pcl::common::IntensityFieldAccessor<PointInT> >
56 class IntensityGradientEstimation : public FeatureFromNormals<PointInT, PointNT, PointOutT>
57 {
58 public:
68
70
71 /** \brief Empty constructor. */
73 {
74 feature_name_ = "IntensityGradientEstimation";
75 };
76
77 /** \brief Initialize the scheduler and set the number of threads to use.
78 * \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
79 */
80 inline void
82
83 protected:
84 /** \brief Estimate the intensity gradients for a set of points given in <setInputCloud (), setIndices ()> using
85 * the surface in setSearchSurface () and the spatial locator in setSearchMethod ().
86 * \param output the resultant point cloud that contains the intensity gradient vectors
87 */
88 void
90
91 /** \brief Estimate the intensity gradient around a given point based on its spatial neighborhood of points
92 * \param cloud a point cloud dataset containing XYZI coordinates (Cartesian coordinates + intensity)
93 * \param indices the indices of the neighoring points in the dataset
94 * \param point the 3D Cartesian coordinates of the point at which to estimate the gradient
95 * \param mean_intensity
96 * \param normal the 3D surface normal of the given point
97 * \param gradient the resultant 3D gradient vector
98 */
99 void
101 const pcl::Indices &indices,
102 const Eigen::Vector3f &point,
103 float mean_intensity,
104 const Eigen::Vector3f &normal,
105 Eigen::Vector3f &gradient);
106
107 protected:
108 ///intensity field accessor structure
110 ///number of threads to be used, default 0 (auto)
111 unsigned int threads_;
112 };
113}
114
115#ifdef PCL_NO_PRECOMPILE
116#include <pcl/features/impl/intensity_gradient.hpp>
117#endif
Iterator class for point clouds with or without given indices.
PointCloudNConstPtr normals_
A pointer to the input dataset that contains the point normals of the XYZ dataset.
Definition feature.h:355
Feature represents the base feature class.
Definition feature.h:107
double search_parameter_
The actual search parameter (from either search_radius_ or k_).
Definition feature.h:237
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition feature.h:247
int k_
The number of K nearest neighbors to use for each point.
Definition feature.h:243
std::string feature_name_
The feature name.
Definition feature.h:223
PointCloudInConstPtr surface_
An input point cloud describing the surface that is to be used for nearest neighbors estimation.
Definition feature.h:231
IntensityGradientEstimation estimates the intensity gradient for a point cloud that contains position...
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
void computePointIntensityGradient(const pcl::PointCloud< PointInT > &cloud, const pcl::Indices &indices, const Eigen::Vector3f &point, float mean_intensity, const Eigen::Vector3f &normal, Eigen::Vector3f &gradient)
Estimate the intensity gradient around a given point based on its spatial neighborhood of points.
IntensitySelectorT intensity_
intensity field accessor structure
void computeFeature(PointCloudOut &output) override
Estimate the intensity gradients for a set of points given in <setInputCloud (), setIndices ()> using...
unsigned int threads_
number of threads to be used, default 0 (auto)
IntensityGradientEstimation()
Empty constructor.
typename Feature< PointInT, PointOutT >::PointCloudOut PointCloudOut
IndicesPtr indices_
A pointer to the vector of point indices to use.
Definition pcl_base.h:150
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition types.h:133