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

Method getBlurredImageUsingIntegralImage

common/src/range_image.cpp:916–959  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

914
915/////////////////////////////////////////////////////////////////////////
916void
917RangeImage::getBlurredImageUsingIntegralImage (int blur_radius, float* integral_image, int* valid_points_num_image,
918 RangeImage& blurred_image) const
919{
920 this->copyTo(blurred_image);
921 for (int y=0; y<static_cast<int>(height); ++y)
922 {
923 for (int x=0; x<static_cast<int>(width); ++x)
924 {
925 const PointWithRange& old_point = getPoint (x, y);
926 PointWithRange& new_point = blurred_image.getPoint (x, y);
927 if (!std::isfinite (old_point.range))
928 continue;
929
930 int top= (std::max) (-1, y-blur_radius-1), right = (std::min) (static_cast<int> (width)-1, x+blur_radius), bottom =
931 (std::min) (static_cast<int> (height)-1, y+blur_radius), left= (std::max) (-1, x-blur_radius-1);
932
933 float top_left_value=0, top_right_value=0,
934 bottom_right_value=integral_image[bottom*width+right], bottom_left_value=0;
935 int top_left_valid_points=0, top_right_valid_points=0,
936 bottom_right_valid_points=valid_points_num_image[bottom*width+right], bottom_left_valid_points=0;
937 if (left>=0)
938 {
939 bottom_left_value = integral_image[bottom*width+left];
940 bottom_left_valid_points = valid_points_num_image[bottom*width+left];
941 if (top>=0)
942 {
943 top_left_value = integral_image[top*width+left];
944 top_left_valid_points = valid_points_num_image[top*width+left];
945 }
946 }
947 if (top>=0)
948 {
949 top_right_value = integral_image[top*width+right];
950 top_right_valid_points = valid_points_num_image[top*width+right];
951 }
952 int valid_points_num = bottom_right_valid_points + top_left_valid_points - bottom_left_valid_points -
953 top_right_valid_points;
954 new_point.range = (bottom_right_value + top_left_value - bottom_left_value - top_right_value) /
955 static_cast<float> (valid_points_num);
956 }
957 }
958 blurred_image.recalculate3DPointPositions ();
959}
960
961/////////////////////////////////////////////////////////////////////////
962void

Callers

nothing calls this directly

Calls 4

copyToMethod · 0.95
getPointFunction · 0.50
getPointMethod · 0.45

Tested by

no test coverage detected