Point Cloud Library (PCL)  1.3.1
narf_keypoint.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2010, Willow Garage, Inc.
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of Willow Garage, Inc. nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  *
00034  */
00035 
00036 /* \author Bastian Steder */
00037 
00038 #ifndef PCL_NARF_KEYPOINT_H_
00039 #define PCL_NARF_KEYPOINT_H_
00040 
00041 #include <pcl/pcl_macros.h>
00042 #include <pcl/point_cloud.h>
00043 #include <pcl/point_types.h>
00044 #include <pcl/keypoints/keypoint.h>
00045 
00046 namespace pcl {
00047 
00048 // Forward declarations
00049 class RangeImage;
00050 class RangeImageBorderExtractor;
00051 
00057 class PCL_EXPORTS NarfKeypoint : public Keypoint<PointWithRange, int>
00058 {
00059   public:
00060     // =====TYPEDEFS=====
00061     typedef Keypoint<PointWithRange, int> BaseClass;
00062     
00063     typedef Keypoint<PointWithRange, int>::PointCloudOut PointCloudOut;
00064 
00065     // =====PUBLIC STRUCTS=====
00067     struct Parameters
00068     {
00069       Parameters() : support_size(-1.0f), max_no_of_interest_points(-1), min_distance_between_interest_points(0.25f),
00070                      optimal_distance_to_high_surface_change(0.25), min_interest_value(0.4f),
00071                      min_surface_change_score(0.2f), optimal_range_image_patch_size(10),
00072                      distance_for_additional_points(0.0f), add_points_on_straight_edges(false),
00073                      do_non_maximum_suppression(true), no_of_polynomial_approximations_per_point(1),
00074                      max_no_of_threads(1) {}
00075       
00076       float support_size;  
00077       int max_no_of_interest_points;  
00078       float min_distance_between_interest_points;  
00081       float optimal_distance_to_high_surface_change;  
00085       float min_interest_value;  
00086       float min_surface_change_score;  
00087       int optimal_range_image_patch_size;  
00091       // TODO:
00092       float distance_for_additional_points;  
00096       bool add_points_on_straight_edges;  
00098       bool do_non_maximum_suppression;  
00101       bool no_of_polynomial_approximations_per_point; 
00104       int max_no_of_threads;  
00105     };
00106     
00107     // =====CONSTRUCTOR & DESTRUCTOR=====
00108     NarfKeypoint (RangeImageBorderExtractor* range_image_border_extractor=NULL, float support_size=-1.0f);
00109     ~NarfKeypoint ();
00110     
00111     // =====PUBLIC METHODS=====
00113     void
00114       clearData ();
00115     
00117     void
00118       setRangeImageBorderExtractor (RangeImageBorderExtractor* range_image_border_extractor);
00119     
00121     RangeImageBorderExtractor*
00122       getRangeImageBorderExtractor ()  { return range_image_border_extractor_; }
00123     
00125     void
00126       setRangeImage (const RangeImage* range_image);
00127     
00129     float*
00130       getInterestImage () { calculateInterestImage(); return interest_image_;}
00131     
00133     const ::pcl::PointCloud<InterestPoint>&
00134       getInterestPoints () { calculateInterestPoints(); return *interest_points_;}
00135     
00137     const std::vector<bool>&
00138       getIsInterestPointImage () { calculateInterestPoints(); return is_interest_point_image_;}
00139     
00141     Parameters&
00142       getParameters () { return parameters_;}
00143     
00145     const RangeImage&
00146       getRangeImage ();
00147     
00149     void
00150       compute (PointCloudOut& output);
00151     
00152   protected:
00153     // =====PROTECTED METHODS=====
00154     void
00155       calculateScaleSpace ();
00156     void
00157       calculateInterestImage ();
00158     void
00159       calculateInterestPoints ();
00160     //void
00161       //blurInterestImage ();
00163     virtual void
00164       detectKeypoints (PointCloudOut& output);
00165     
00166     // =====PROTECTED MEMBER VARIABLES=====
00167     using BaseClass::name_;
00168     RangeImageBorderExtractor* range_image_border_extractor_;
00169     Parameters parameters_;
00170     float* interest_image_;
00171     ::pcl::PointCloud<InterestPoint>* interest_points_;
00172     std::vector<bool> is_interest_point_image_;
00173     std::vector<RangeImage*> range_image_scale_space_;
00174     std::vector<RangeImageBorderExtractor*> border_extractor_scale_space_;
00175     std::vector<float*> interest_image_scale_space_;
00176 };
00177 
00181 inline std::ostream&
00182   operator << (std::ostream& os, const NarfKeypoint::Parameters& p)
00183 {
00184   os << PVARC(p.support_size) << PVARC(p.min_distance_between_interest_points)
00185      << PVARC(p.min_interest_value) << PVARN(p.distance_for_additional_points);
00186   return (os);
00187 }
00188 
00189 }  // end namespace pcl
00190 
00191 #endif  //#ifndef PCL_NARF_KEYPOINT_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines