/usr/include/pcl-1.7/pcl/features/narf.h is in libpcl-dev 1.7.2-14build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | /*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2010, Willow Garage, Inc.
* Copyright (c) 2012-, Open Perception, 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 the copyright holder(s) 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.
*
*/
#ifndef PCL_NARF_H_
#define PCL_NARF_H_
#include <pcl/features/eigen.h>
#include <pcl/common/common_headers.h>
#include <pcl/point_representation.h>
namespace pcl
{
// Forward declarations
class RangeImage;
struct InterestPoint;
#define NARF_DEFAULT_SURFACE_PATCH_PIXEL_SIZE 10
/**
* \brief NARF (Normal Aligned Radial Features) is a point feature descriptor type for 3D data.
* Please refer to pcl/features/narf_descriptor.h if you want the class derived from pcl Feature.
* See B. Steder, R. B. Rusu, K. Konolige, and W. Burgard
* Point Feature Extraction on 3D Range Scans Taking into Account Object Boundaries
* In Proc. of the IEEE Int. Conf. on Robotics &Automation (ICRA). 2011.
* \author Bastian Steder
* \ingroup features
*/
class PCL_EXPORTS Narf
{
public:
// =====CONSTRUCTOR & DESTRUCTOR=====
//! Constructor
Narf();
//! Copy Constructor
Narf(const Narf& other);
//! Destructor
~Narf();
// =====Operators=====
//! Assignment operator
const Narf& operator=(const Narf& other);
// =====STATIC=====
/** The maximum number of openmp threads that can be used in this class */
static int max_no_of_threads;
/** Add features extracted at the given interest point and add them to the list */
static void
extractFromRangeImageAndAddToList (const RangeImage& range_image, const Eigen::Vector3f& interest_point, int descriptor_size,
float support_size, bool rotation_invariant, std::vector<Narf*>& feature_list);
/** Same as above */
static void
extractFromRangeImageAndAddToList (const RangeImage& range_image, float image_x, float image_y, int descriptor_size,
float support_size, bool rotation_invariant, std::vector<Narf*>& feature_list);
/** Get a list of features from the given interest points. */
static void
extractForInterestPoints (const RangeImage& range_image, const PointCloud<InterestPoint>& interest_points,
int descriptor_size, float support_size, bool rotation_invariant, std::vector<Narf*>& feature_list);
/** Extract an NARF for every point in the range image. */
static void
extractForEveryRangeImagePointAndAddToList (const RangeImage& range_image, int descriptor_size, float support_size,
bool rotation_invariant, std::vector<Narf*>& feature_list);
// =====PUBLIC METHODS=====
/** Method to extract a NARF feature from a certain 3D point using a range image.
* pose determines the coordinate system of the feature, whereas it transforms a point from the world into the feature system.
* This means the interest point at which the feature is extracted will be the inverse application of pose onto (0,0,0).
* descriptor_size_ determines the size of the descriptor,
* support_size determines the support size of the feature, meaning the size in the world it covers */
bool
extractFromRangeImage (const RangeImage& range_image, const Eigen::Affine3f& pose, int descriptor_size, float support_size,
int surface_patch_world_size=NARF_DEFAULT_SURFACE_PATCH_PIXEL_SIZE);
//! Same as above, but determines the transformation from the surface in the range image
bool
extractFromRangeImage (const RangeImage& range_image, float x, float y, int descriptor_size, float support_size);
//! Same as above
bool
extractFromRangeImage (const RangeImage& range_image, const InterestPoint& interest_point, int descriptor_size, float support_size);
//! Same as above
bool
extractFromRangeImage (const RangeImage& range_image, const Eigen::Vector3f& interest_point, int descriptor_size, float support_size);
/** Same as above, but using the rotational invariant version by choosing the best extracted rotation around the normal.
* Use extractFromRangeImageAndAddToList if you want to enable the system to return multiple features with different rotations. */
bool
extractFromRangeImageWithBestRotation (const RangeImage& range_image, const Eigen::Vector3f& interest_point,
int descriptor_size, float support_size);
/* Get the dominant rotations of the current descriptor
* \param rotations the returned rotations
* \param strength values describing how pronounced the corresponding rotations are
*/
void
getRotations (std::vector<float>& rotations, std::vector<float>& strengths) const;
/* Get the feature with a different rotation around the normal
* You are responsible for deleting the new features!
* \param range_image the source from which the feature is extracted
* \param rotations list of angles (in radians)
* \param rvps returned features
*/
void
getRotatedVersions (const RangeImage& range_image, const std::vector<float>& rotations, std::vector<Narf*>& features) const;
//! Calculate descriptor distance, value in [0,1] with 0 meaning identical and 1 every cell above maximum distance
inline float
getDescriptorDistance (const Narf& other) const;
//! How many points on each beam of the gradient star are used to calculate the descriptor?
inline int
getNoOfBeamPoints () const { return (static_cast<int> (pcl_lrint (ceil (0.5f * float (surface_patch_pixel_size_))))); }
//! Copy the descriptor and pose to the point struct Narf36
inline void
copyToNarf36 (Narf36& narf36) const;
/** Write to file */
void
saveBinary (const std::string& filename) const;
/** Write to output stream */
void
saveBinary (std::ostream& file) const;
/** Read from file */
void
loadBinary (const std::string& filename);
/** Read from input stream */
void
loadBinary (std::istream& file);
//! Create the descriptor from the already set other members
bool
extractDescriptor (int descriptor_size);
// =====GETTERS=====
//! Getter (const) for the descriptor
inline const float*
getDescriptor () const { return descriptor_;}
//! Getter for the descriptor
inline float*
getDescriptor () { return descriptor_;}
//! Getter (const) for the descriptor length
inline const int&
getDescriptorSize () const { return descriptor_size_;}
//! Getter for the descriptor length
inline int&
getDescriptorSize () { return descriptor_size_;}
//! Getter (const) for the position
inline const Eigen::Vector3f&
getPosition () const { return position_;}
//! Getter for the position
inline Eigen::Vector3f&
getPosition () { return position_;}
//! Getter (const) for the 6DoF pose
inline const Eigen::Affine3f&
getTransformation () const { return transformation_;}
//! Getter for the 6DoF pose
inline Eigen::Affine3f&
getTransformation () { return transformation_;}
//! Getter (const) for the pixel size of the surface patch (only one dimension)
inline const int&
getSurfacePatchPixelSize () const { return surface_patch_pixel_size_;}
//! Getter for the pixel size of the surface patch (only one dimension)
inline int&
getSurfacePatchPixelSize () { return surface_patch_pixel_size_;}
//! Getter (const) for the world size of the surface patch
inline const float&
getSurfacePatchWorldSize () const { return surface_patch_world_size_;}
//! Getter for the world size of the surface patch
inline float&
getSurfacePatchWorldSize () { return surface_patch_world_size_;}
//! Getter (const) for the rotation of the surface patch
inline const float&
getSurfacePatchRotation () const { return surface_patch_rotation_;}
//! Getter for the rotation of the surface patch
inline float&
getSurfacePatchRotation () { return surface_patch_rotation_;}
//! Getter (const) for the surface patch
inline const float*
getSurfacePatch () const { return surface_patch_;}
//! Getter for the surface patch
inline float*
getSurfacePatch () { return surface_patch_;}
//! Method to erase the surface patch and free the memory
inline void
freeSurfacePatch () { delete[] surface_patch_; surface_patch_=NULL; surface_patch_pixel_size_=0; }
// =====SETTERS=====
//! Setter for the descriptor
inline void
setDescriptor (float* descriptor) { descriptor_ = descriptor;}
//! Setter for the surface patch
inline void
setSurfacePatch (float* surface_patch) { surface_patch_ = surface_patch;}
// =====PUBLIC MEMBER VARIABLES=====
// =====PUBLIC STRUCTS=====
struct FeaturePointRepresentation : public PointRepresentation<Narf*>
{
typedef Narf* PointT;
FeaturePointRepresentation(int nr_dimensions) { this->nr_dimensions_ = nr_dimensions; }
/** \brief Empty destructor */
virtual ~FeaturePointRepresentation () {}
virtual void copyToFloatArray (const PointT& p, float* out) const { memcpy(out, p->getDescriptor(), sizeof(*p->getDescriptor())*this->nr_dimensions_); }
};
protected:
// =====PROTECTED METHODS=====
//! Reset al members to default values and free allocated memory
void
reset ();
//! Create a deep copy of other
void
deepCopy (const Narf& other);
//! Get the surface patch with a blur on it
float*
getBlurredSurfacePatch (int new_pixel_size, int blur_radius) const;
/** Write header to output stream */
void
saveHeader (std::ostream& file) const;
/** Read header from input stream */
int
loadHeader (std::istream& file) const;
// =====PROTECTED STATIC METHODS=====
static const std::string
getHeaderKeyword () { return "NARF"; }
// =====PROTECTED STATIC VARIABLES=====
const static int VERSION = 1;
// =====PROTECTED MEMBER VARIABLES=====
Eigen::Vector3f position_;
Eigen::Affine3f transformation_;
float* surface_patch_;
int surface_patch_pixel_size_;
float surface_patch_world_size_;
float surface_patch_rotation_;
float* descriptor_;
int descriptor_size_;
// =====STATIC PROTECTED=====
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
#undef NARF_DEFAULT_SURFACE_PATCH_PIXEL_SIZE
} // end namespace pcl
#include <pcl/features/impl/narf.hpp>
#endif //#ifndef PCL_NARF_H_
|