41#ifndef PCL_FILTERS_IMPL_PYRAMID_HPP
42#define PCL_FILTERS_IMPL_PYRAMID_HPP
51template <
typename Po
intT>
bool
52Pyramid<PointT>::initCompute ()
54 if (!input_->isOrganized ())
56 PCL_ERROR (
"[pcl::fileters::%s::initCompute] Number of levels should be at least 2!\n", getClassName ().c_str ());
62 PCL_ERROR (
"[pcl::fileters::%s::initCompute] Number of levels should be at least 2!\n", getClassName ().c_str ());
72 PCL_ERROR (
"[pcl::fileters::%s::initCompute] Number of levels should not exceed 4!\n", getClassName ().c_str ());
78 Eigen::VectorXf k (5);
79 k << 1.f/16.f, 1.f/4.f, 3.f/8.f, 1.f/4.f, 1.f/16.f;
80 kernel_ = k * k.transpose ();
81 if (threshold_ != std::numeric_limits<float>::infinity ())
82 threshold_ *= 2 * threshold_;
87 Eigen::VectorXf k (3);
88 k << 1.f/4.f, 1.f/2.f, 1.f/4.f;
89 kernel_ = k * k.transpose ();
90 if (threshold_ != std::numeric_limits<float>::infinity ())
91 threshold_ *= threshold_;
97template <
typename Po
intT>
void
100 std::cout <<
"compute" << std::endl;
103 PCL_ERROR (
"[pcl::%s::compute] initCompute failed!\n", getClassName ().
c_str ());
107 int kernel_rows =
static_cast<int> (kernel_.rows ());
108 int kernel_cols =
static_cast<int> (kernel_.cols ());
112 output.resize (levels_ + 1);
116 if (input_->is_dense)
118 for (
int l = 1; l <= levels_; ++l)
123#pragma omp parallel for \
126 num_threads(threads_)
127 for(
int i=0; i < next.height; ++i)
129 for(
int j=0; j < next.width; ++j)
154 for (
int l = 1; l <= levels_; ++l)
159#pragma omp parallel for \
162 num_threads(threads_)
163 for(
int i=0; i < next.height; ++i)
165 for(
int j=0; j < next.width; ++j)
185 weight+= kernel_ (
mm,
nn);
190 nullify (next.at (j,i));
194 next.at (j,i)*= weight;
206 std::cout <<
"PointXYZRGB" << std::endl;
209 PCL_ERROR (
"[pcl::%s::compute] initCompute failed!\n", getClassName ().
c_str ());
213 int kernel_rows =
static_cast<int> (kernel_.rows ());
214 int kernel_cols =
static_cast<int> (kernel_.cols ());
218 output.resize (levels_ + 1);
222 if (input_->is_dense)
224 for (
int l = 1; l <= levels_; ++l)
229#pragma omp parallel for \
232 num_threads(threads_)
233 for(
int i=0; i < next.height; ++i)
235 for(
int j=0; j < next.width; ++j)
237 float r = 0, g = 0, b = 0;
261 next.at (j,i).b =
static_cast<std::uint8_t
> (b);
262 next.at (j,i).g =
static_cast<std::uint8_t
> (g);
263 next.at (j,i).r =
static_cast<std::uint8_t
> (r);
270 for (
int l = 1; l <= levels_; ++l)
275#pragma omp parallel for \
278 num_threads(threads_)
279 for(
int i=0; i < next.height; ++i)
281 for(
int j=0; j < next.width; ++j)
284 float r = 0, g = 0, b = 0;
307 weight+= kernel_ (
mm,
nn);
312 nullify (next.at (j,i));
316 r*= weight; g*= weight; b*= weight;
317 next.at (j,i).x*= weight; next.at (j,i).y*= weight; next.at (j,i).z*= weight;
318 next.at (j,i).b =
static_cast<std::uint8_t
> (b);
319 next.at (j,i).g =
static_cast<std::uint8_t
> (g);
320 next.at (j,i).r =
static_cast<std::uint8_t
> (r);
331 std::cout <<
"PointXYZRGBA" << std::endl;
334 PCL_ERROR (
"[pcl::%s::compute] initCompute failed!\n", getClassName ().
c_str ());
338 int kernel_rows =
static_cast<int> (kernel_.rows ());
339 int kernel_cols =
static_cast<int> (kernel_.cols ());
343 output.resize (levels_ + 1);
347 if (input_->is_dense)
349 for (
int l = 1; l <= levels_; ++l)
354#pragma omp parallel for \
357 num_threads(threads_)
358 for(
int i=0; i < next.height; ++i)
360 for(
int j=0; j < next.width; ++j)
362 float r = 0, g = 0, b = 0, a = 0;
387 next.at (j,i).b =
static_cast<std::uint8_t
> (b);
388 next.at (j,i).g =
static_cast<std::uint8_t
> (g);
389 next.at (j,i).r =
static_cast<std::uint8_t
> (r);
390 next.at (j,i).a =
static_cast<std::uint8_t
> (a);
397 for (
int l = 1; l <= levels_; ++l)
402#pragma omp parallel for \
405 num_threads(threads_)
406 for(
int i=0; i < next.height; ++i)
408 for(
int j=0; j < next.width; ++j)
411 float r = 0, g = 0, b = 0, a = 0;
435 weight+= kernel_ (
mm,
nn);
440 nullify (next.at (j,i));
444 r*= weight; g*= weight; b*= weight; a*= weight;
445 next.at (j,i).x*= weight; next.at (j,i).y*= weight; next.at (j,i).z*= weight;
446 next.at (j,i).b =
static_cast<std::uint8_t
> (b);
447 next.at (j,i).g =
static_cast<std::uint8_t
> (g);
448 next.at (j,i).r =
static_cast<std::uint8_t
> (r);
449 next.at (j,i).a =
static_cast<std::uint8_t
> (a);
460 p.r = 0; p.g = 0; p.b = 0;
466 std::cout <<
"RGB" << std::endl;
469 PCL_ERROR (
"[pcl::%s::compute] initCompute failed!\n", getClassName ().
c_str ());
473 int kernel_rows =
static_cast<int> (kernel_.rows ());
474 int kernel_cols =
static_cast<int> (kernel_.cols ());
478 output.resize (levels_ + 1);
482 if (input_->is_dense)
484 for (
int l = 1; l <= levels_; ++l)
489#pragma omp parallel for \
492 num_threads(threads_)
493 for(
int i=0; i < next.height; ++i)
495 for(
int j=0; j < next.width; ++j)
497 float r = 0, g = 0, b = 0;
515 next.at (j,i).b =
static_cast<std::uint8_t
> (b);
516 next.at (j,i).g =
static_cast<std::uint8_t
> (g);
517 next.at (j,i).r =
static_cast<std::uint8_t
> (r);
524 for (
int l = 1; l <= levels_; ++l)
529#pragma omp parallel for \
532 num_threads(threads_)
533 for(
int i=0; i < next.height; ++i)
535 for(
int j=0; j < next.width; ++j)
538 float r = 0, g = 0, b = 0;
558 weight+= kernel_ (
mm,
nn);
563 nullify (next.at (j,i));
567 r*= weight; g*= weight; b*= weight;
568 next.at (j,i).b =
static_cast<std::uint8_t
> (b);
569 next.at (j,i).g =
static_cast<std::uint8_t
> (g);
570 next.at (j,i).r =
static_cast<std::uint8_t
> (r);
Iterator class for point clouds with or without given indices.
Pyramid constructs a multi-scale representation of an organised point cloud.
void compute(std::vector< PointCloudPtr > &output)
compute the pyramid levels.
typename PointCloud< PointT >::Ptr PointCloudPtr
float squaredEuclideanDistance(const PointType1 &p1, const PointType2 &p2)
Calculate the squared euclidean distance between the two given points.
bool isFinite(const PointT &pt)
Tests if the 3D components of a point are all finite param[in] pt point to be tested return true if f...
A structure representing RGB color information.