45 const std::string& output_order)
52 size_t min_x = std::min(roi.
min_x, max_x);
53 size_t min_y = std::min(roi.
min_y, max_y);
55 step_x = std::max<size_t>(std::min(step_x, max_x - min_x), 1);
56 step_y = std::max<size_t>(std::min(step_y, max_y - min_y), 1);
59 size_t size_x = (max_x - min_x) / step_x;
60 size_t size_y = (max_y - min_y) / step_y;
61 pointCloud.
resize(size_x, size_y);
63 const char* mapping = output_order.c_str();
65 char axes[3] = {mapping[1], mapping[3], mapping[5]};
66 for (
size_t i = 0, u = min_x; u < max_x; i++, u += step_x)
68 for (
size_t j = 0, v = min_y; v < max_y; j++, v += step_y)
76 values_xyz[2] = depth.
pixel(u, v);
78 pointCloud(i,j).x = (mapping[0] ==
'-') ? (-values_xyz[axes[0] -
'X']) : (values_xyz[axes[0] -
'X']);
79 pointCloud(i,j).y = (mapping[2] ==
'-') ? (-values_xyz[axes[1] -
'X']) : (values_xyz[axes[1] -
'X']);
80 pointCloud(i,j).z = (mapping[4] ==
'-') ? (-values_xyz[axes[2] -
'X']) : (values_xyz[axes[2] -
'X']);
yarp::sig::PointCloud< yarp::sig::DataXYZ > depthToPC(const yarp::sig::ImageOf< yarp::sig::PixelFloat > &depth, const yarp::sig::IntrinsicParams &intrinsic)
depthToPC, compute the PointCloud given depth image and the intrinsic parameters of the camera.