48 if (!
input_->isOrganized ())
50 PCL_ERROR (
"[pcl::MedianFilter] Input cloud needs to be organized\n");
57 int height =
static_cast<int> (output.height);
58 int width =
static_cast<int> (output.width);
59 for (
int y = 0; y < height; ++y)
60 for (
int x = 0; x < width; ++x)
63 std::vector<float> vals;
69 if (x + x_dev >= 0 && x + x_dev < width &&
70 y + y_dev >= 0 && y + y_dev < height &&
72 vals.push_back ((*
input_)(x+x_dev, y+y_dev).z);
79 auto middle_it = vals.begin () + vals.size () / 2;
80 std::nth_element (vals.begin (), middle_it, vals.end ());
81 float new_depth = *middle_it;
84 output (x, y).z = new_depth;
86 output (x, y).z = (*input_)(x, y).z +
void copyPointCloud(const pcl::PointCloud< PointInT > &cloud_in, pcl::PointCloud< PointOutT > &cloud_out)
Copy all the fields from a given point cloud into a new point cloud.