board.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Point Cloud Library (PCL) - www.pointclouds.org
00005  *  Copyright (c) 2010-2012, Willow Garage, Inc.
00006  *  Copyright (c) 2012-, Open Perception, Inc.
00007  *
00008  *  All rights reserved.
00009  *
00010  *  Redistribution and use in source and binary forms, with or without
00011  *  modification, are permitted provided that the following conditions
00012  *  are met:
00013  *
00014  *   * Redistributions of source code must retain the above copyright
00015  *     notice, this list of conditions and the following disclaimer.
00016  *   * Redistributions in binary form must reproduce the above
00017  *     copyright notice, this list of conditions and the following
00018  *     disclaimer in the documentation and/or other materials provided
00019  *     with the distribution.
00020  *   * Neither the name of the copyright holder(s) nor the names of its
00021  *     contributors may be used to endorse or promote products derived
00022  *     from this software without specific prior written permission.
00023  *
00024  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00025  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00026  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00027  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00028  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00029  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00030  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00031  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00032  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00033  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00034  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00035  *  POSSIBILITY OF SUCH DAMAGE.
00036  *
00037  *
00038  */
00039 
00040 #ifndef PCL_BOARD_H_
00041 #define PCL_BOARD_H_
00042 
00043 #include <pcl/point_types.h>
00044 #include <pcl/features/feature.h>
00045 
00046 namespace pcl
00047 {
00058   template<typename PointInT, typename PointNT, typename PointOutT = ReferenceFrame>
00059   class BOARDLocalReferenceFrameEstimation : public FeatureFromNormals<PointInT, PointNT, PointOutT>
00060   {
00061     public:
00062       typedef boost::shared_ptr<BOARDLocalReferenceFrameEstimation<PointInT, PointNT, PointOutT> > Ptr;
00063       typedef boost::shared_ptr<const BOARDLocalReferenceFrameEstimation<PointInT, PointNT, PointOutT> > ConstPtr;
00064 
00066       BOARDLocalReferenceFrameEstimation () :
00067         tangent_radius_ (0.0f),
00068         find_holes_ (false),
00069         margin_thresh_ (0.85f),
00070         check_margin_array_size_ (24),
00071         hole_size_prob_thresh_ (0.2f),
00072         steep_thresh_ (0.1f),
00073         check_margin_array_ (),
00074         margin_array_min_angle_ (),
00075         margin_array_max_angle_ (),
00076         margin_array_min_angle_normal_ (),
00077         margin_array_max_angle_normal_ ()
00078       {
00079         feature_name_ = "BOARDLocalReferenceFrameEstimation";
00080         setCheckMarginArraySize (check_margin_array_size_);
00081       }
00082       
00084       virtual ~BOARDLocalReferenceFrameEstimation () {}
00085 
00086       //Getters/Setters
00087 
00092       inline void
00093       setTangentRadius (float radius)
00094       {
00095         tangent_radius_ = radius;
00096       }
00097 
00102       inline float
00103       getTangentRadius () const
00104       {
00105         return (tangent_radius_);
00106       }
00107 
00113       inline void
00114       setFindHoles (bool find_holes)
00115       {
00116         find_holes_ = find_holes;
00117       }
00118 
00124       inline bool
00125       getFindHoles () const
00126       {
00127         return (find_holes_);
00128       }
00129 
00134       inline void
00135       setMarginThresh (float margin_thresh)
00136       {
00137         margin_thresh_ = margin_thresh;
00138       }
00139 
00144       inline float
00145       getMarginThresh () const
00146       {
00147         return (margin_thresh_);
00148       }
00149 
00154       void
00155       setCheckMarginArraySize (int size)
00156       {
00157         check_margin_array_size_ = size;
00158 
00159         check_margin_array_.clear ();
00160         check_margin_array_.resize (check_margin_array_size_);
00161 
00162         margin_array_min_angle_.clear ();
00163         margin_array_min_angle_.resize (check_margin_array_size_);
00164 
00165         margin_array_max_angle_.clear ();
00166         margin_array_max_angle_.resize (check_margin_array_size_);
00167 
00168         margin_array_min_angle_normal_.clear ();
00169         margin_array_min_angle_normal_.resize (check_margin_array_size_);
00170 
00171         margin_array_max_angle_normal_.clear ();
00172         margin_array_max_angle_normal_.resize (check_margin_array_size_);
00173       }
00174 
00179       inline int
00180       getCheckMarginArraySize () const
00181       {
00182         return (check_margin_array_size_);
00183       }
00184 
00190       inline void
00191       setHoleSizeProbThresh (float prob_thresh)
00192       {
00193         hole_size_prob_thresh_ = prob_thresh;
00194       }
00195 
00201       inline float
00202       getHoleSizeProbThresh () const
00203       {
00204         return (hole_size_prob_thresh_);
00205       }
00206 
00212       inline void
00213       setSteepThresh (float steep_thresh)
00214       {
00215         steep_thresh_ = steep_thresh;
00216       }
00217 
00223       inline float
00224       getSteepThresh () const
00225       {
00226         return (steep_thresh_);
00227       }
00228 
00229     protected:
00230       using Feature<PointInT, PointOutT>::feature_name_;
00231       using Feature<PointInT, PointOutT>::getClassName;
00232       using Feature<PointInT, PointOutT>::input_;
00233       using Feature<PointInT, PointOutT>::indices_;
00234       using Feature<PointInT, PointOutT>::surface_;
00235       using Feature<PointInT, PointOutT>::tree_;
00236       using Feature<PointInT, PointOutT>::search_parameter_;
00237       using FeatureFromNormals<PointInT, PointNT, PointOutT>::normals_;
00238 
00239       typedef typename Feature<PointInT, PointOutT>::PointCloudIn PointCloudIn;
00240       typedef typename Feature<PointInT, PointOutT>::PointCloudOut PointCloudOut;
00241 
00242       void
00243       resetData ()
00244       {
00245         setCheckMarginArraySize (check_margin_array_size_);
00246       }
00247 
00252       float
00253       computePointLRF (const int &index, Eigen::Matrix3f &lrf);
00254 
00258       virtual void
00259       computeFeature (PointCloudOut &output);
00260 
00270       void
00271       directedOrthogonalAxis (Eigen::Vector3f const &axis, Eigen::Vector3f const &axis_origin,
00272                               Eigen::Vector3f const &point, Eigen::Vector3f &directed_ortho_axis);
00273 
00281       float
00282       getAngleBetweenUnitVectors (Eigen::Vector3f const &v1, Eigen::Vector3f const &v2, Eigen::Vector3f const &axis);
00283 
00290       void
00291       normalDisambiguation (pcl::PointCloud<PointNT> const &normals_cloud, std::vector<int> const &normal_indices,
00292                             Eigen::Vector3f &normal);
00293 
00300       void
00301       planeFitting (Eigen::Matrix<float, Eigen::Dynamic, 3> const &points, Eigen::Vector3f &center,
00302                     Eigen::Vector3f &norm);
00303 
00313       void
00314       projectPointOnPlane (Eigen::Vector3f const &point, Eigen::Vector3f const &origin_point,
00315                            Eigen::Vector3f const &plane_normal, Eigen::Vector3f &projected_point);
00316 
00322       void
00323       randomOrthogonalAxis (Eigen::Vector3f const &axis, Eigen::Vector3f &rand_ortho_axis);
00324 
00332       inline bool
00333       areEquals (float val1, float val2, float zero_float_eps = 1E-8f) const
00334       {
00335         return (std::abs (val1 - val2) < zero_float_eps);
00336       }
00337 
00338     private:
00340       float tangent_radius_;
00341 
00343       bool find_holes_;
00344 
00346       float margin_thresh_; 
00347 
00349       int check_margin_array_size_; 
00350 
00352       float hole_size_prob_thresh_; 
00353 
00355       float steep_thresh_; 
00356 
00357       std::vector<bool> check_margin_array_;
00358       std::vector<float> margin_array_min_angle_;
00359       std::vector<float> margin_array_max_angle_;
00360       std::vector<float> margin_array_min_angle_normal_;
00361       std::vector<float> margin_array_max_angle_normal_;
00362   };
00363 }
00364 
00365 #ifdef PCL_NO_PRECOMPILE
00366 #include <pcl/features/impl/board.hpp>
00367 #endif
00368 
00369 #endif  //#ifndef PCL_BOARD_H_


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:22:36