43 #include <pcl/point_cloud.h>
44 #include <pcl/features/feature.h>
45 #include <pcl/features/integral_image2D.h>
64 template <
typename Po
intInT,
typename Po
intOutT>
74 using Ptr = shared_ptr<IntegralImageNormalEstimation<PointInT, PointOutT> >;
75 using ConstPtr = shared_ptr<const IntegralImageNormalEstimation<PointInT, PointOutT> >;
110 , rect_width_ (0), rect_width_2_ (0), rect_width_4_ (0)
111 , rect_height_ (0), rect_height_2_ (0), rect_height_4_ (0)
112 , distance_threshold_ (0)
113 , integral_image_DX_ (false)
114 , integral_image_DY_ (false)
115 , integral_image_depth_ (false)
116 , integral_image_XYZ_ (true)
119 , depth_data_ (nullptr)
120 , distance_map_ (nullptr)
121 , use_depth_dependent_smoothing_ (false)
122 , max_depth_change_factor_ (20.0f*0.001f)
123 , normal_smoothing_size_ (10.0f)
124 , init_covariance_matrix_ (false)
125 , init_average_3d_gradient_ (false)
126 , init_simple_3d_gradient_ (false)
127 , init_depth_change_ (false)
131 , use_sensor_origin_ (true)
154 border_policy_ = border_policy;
164 computePointNormal (
const int pos_x,
const int pos_y,
const unsigned point_index, PointOutT &normal);
182 max_depth_change_factor_ = max_depth_change_factor;
192 if (normal_smoothing_size <= 0)
194 PCL_ERROR (
"[pcl::%s::setNormalSmoothingSize] Invalid normal smoothing size given! (%f). Allowed ranges are: 0 < N. Defaulting to %f.\n",
195 feature_name_.c_str (), normal_smoothing_size, normal_smoothing_size_);
198 normal_smoothing_size_ = normal_smoothing_size;
216 normal_estimation_method_ = normal_estimation_method;
225 use_depth_dependent_smoothing_ = use_depth_dependent_smoothing;
235 if (!cloud->isOrganized ())
237 PCL_ERROR (
"[pcl::IntegralImageNormalEstimation::setInputCloud] Input dataset is not organized (height = 1).\n");
241 init_covariance_matrix_ = init_average_3d_gradient_ = init_depth_change_ =
false;
243 if (use_sensor_origin_)
245 vpx_ =
input_->sensor_origin_.coeff (0);
246 vpy_ =
input_->sensor_origin_.coeff (1);
247 vpz_ =
input_->sensor_origin_.coeff (2);
259 return (distance_map_);
273 use_sensor_origin_ =
false;
299 use_sensor_origin_ =
true;
302 vpx_ =
input_->sensor_origin_.coeff (0);
303 vpy_ =
input_->sensor_origin_.coeff (1);
304 vpz_ =
input_->sensor_origin_.coeff (2);
355 flipNormalTowardsViewpoint (
const PointInT &point,
356 float vp_x,
float vp_y,
float vp_z,
357 float &nx,
float &ny,
float &nz)
365 float cos_theta = (vp_x * nx + vp_y * ny + vp_z * nz);
397 float distance_threshold_;
400 IntegralImage2D<float, 3> integral_image_DX_;
402 IntegralImage2D<float, 3> integral_image_DY_;
404 IntegralImage2D<float, 1> integral_image_depth_;
406 IntegralImage2D<float, 3> integral_image_XYZ_;
417 float *distance_map_;
420 bool use_depth_dependent_smoothing_;
423 float max_depth_change_factor_;
426 float normal_smoothing_size_;
429 bool init_covariance_matrix_;
432 bool init_average_3d_gradient_;
435 bool init_simple_3d_gradient_;
438 bool init_depth_change_;
442 float vpx_, vpy_, vpz_;
445 bool use_sensor_origin_;
449 initCompute ()
override;
453 initCovarianceMatrixMethod ();
457 initAverage3DGradientMethod ();
461 initAverageDepthChangeMethod ();
465 initSimple3DGradientMethod ();
472 #ifdef PCL_NO_PRECOMPILE
473 #include <pcl/features/impl/integral_image_normal.hpp>