MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / getBlurredImage

Method getBlurredImage

common/src/range_image.cpp:962–1008  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

960
961/////////////////////////////////////////////////////////////////////////
962void
963RangeImage::getBlurredImage (int blur_radius, RangeImage& blurred_image) const
964{
965 //MEASURE_FUNCTION_TIME;
966
967 if (blur_radius > 1) // For a high blur radius it's faster to use integral images
968 {
969 float* integral_image;
970 int* valid_points_num_image;
971 getIntegralImage (integral_image, valid_points_num_image);
972 getBlurredImageUsingIntegralImage (blur_radius, integral_image, valid_points_num_image, blurred_image);
973 delete[] integral_image;
974 delete[] valid_points_num_image;
975 return;
976 }
977
978 this->copyTo(blurred_image);
979
980 if (blur_radius==0)
981 return;
982
983 for (int y=0; y < static_cast<int> (height); ++y)
984 {
985 for (int x=0; x < static_cast<int> (width); ++x)
986 {
987 PointWithRange& new_point = blurred_image.getPoint (x, y);
988 const PointWithRange& original_point = getPoint (x, y);
989 if (!std::isfinite (original_point.range))
990 continue;
991
992 new_point.range = 0.0f;
993 float weight_sum = 0.0f;
994 for (int y2=y-blur_radius; y2<y+blur_radius; ++y2)
995 {
996 for (int x2=x-blur_radius; x2<x+blur_radius; ++x2)
997 {
998 if (!isValid (x2,y2))
999 continue;
1000 new_point.range += getPoint (x2, y2).range;
1001 weight_sum += 1.0f;
1002 }
1003 }
1004 new_point.range /= weight_sum;
1005 }
1006 }
1007 blurred_image.recalculate3DPointPositions ();
1008}
1009
1010/////////////////////////////////////////////////////////////////////////
1011void

Callers

nothing calls this directly

Calls 4

copyToMethod · 0.95
getPointFunction · 0.50
getPointMethod · 0.45

Tested by

no test coverage detected