Point Cloud Library (PCL)  1.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
principal_curvatures.h
Go to the documentation of this file.
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  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of Willow Garage, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  * $Id: principal_curvatures.h 4864 2012-03-01 01:11:22Z rusu $
37  *
38  */
39 
40 #ifndef PCL_PRINCIPAL_CURVATURES_H_
41 #define PCL_PRINCIPAL_CURVATURES_H_
42 
43 #include <Eigen/StdVector>
44 #include <Eigen/Sparse>
45 #include <pcl/features/feature.h>
46 
47 namespace pcl
48 {
60  template <typename PointInT, typename PointNT, typename PointOutT = pcl::PrincipalCurvatures>
61  class PrincipalCurvaturesEstimation : public FeatureFromNormals<PointInT, PointNT, PointOutT>
62  {
63  public:
72 
75 
78  projected_normals_ (),
79  xyz_centroid_ (Eigen::Vector3f::Zero ()),
80  demean_ (Eigen::Vector3f::Zero ()),
81  covariance_matrix_ (Eigen::Matrix3f::Zero ()),
82  eigenvector_ (Eigen::Vector3f::Zero ()),
83  eigenvalues_ (Eigen::Vector3f::Zero ())
84  {
85  feature_name_ = "PrincipalCurvaturesEstimation";
86  };
87 
100  void
102  int p_idx, const std::vector<int> &indices,
103  float &pcx, float &pcy, float &pcz, float &pc1, float &pc2);
104 
105  protected:
106 
112  void
113  computeFeature (PointCloudOut &output);
114 
115  private:
117  std::vector<Eigen::Vector3f> projected_normals_;
118 
120  Eigen::Vector3f xyz_centroid_;
121 
123  Eigen::Vector3f demean_;
124 
126  EIGEN_ALIGN16 Eigen::Matrix3f covariance_matrix_;
127 
129  Eigen::Vector3f eigenvector_;
131  Eigen::Vector3f eigenvalues_;
132 
136  void
137  computeFeatureEigen (pcl::PointCloud<Eigen::MatrixXf> &) {}
138  };
139 
149  template <typename PointInT, typename PointNT>
150  class PrincipalCurvaturesEstimation<PointInT, PointNT, Eigen::MatrixXf> : public PrincipalCurvaturesEstimation<PointInT, PointNT, pcl::PrincipalCurvatures>
151  {
152  public:
160 
161  private:
167  void
168  computeFeatureEigen (pcl::PointCloud<Eigen::MatrixXf> &output);
169 
173  void
175  };
176 }
177 
178 #endif //#ifndef PCL_PRINCIPAL_CURVATURES_H_