24 size_t w = depth.
width();
29 for (
size_t u = 0; u < w; ++u) {
30 for (
size_t v = 0; v < h; ++v) {
37 pointCloud(u,v).z = depth.
pixel(u,v);
54 size_t min_x = std::min(roi.
min_x, max_x);
55 size_t min_y = std::min(roi.
min_y, max_y);
57 step_x = std::max<size_t>(std::min(step_x, max_x - min_x), 1);
58 step_y = std::max<size_t>(std::min(step_y, max_y - min_y), 1);
61 size_t size_x = (max_x - min_x) / step_x;
62 size_t size_y = (max_y - min_y) / step_y;
63 pointCloud.
resize(size_x, size_y);
65 for (
size_t i = 0, u = min_x; u < max_x; i++, u += step_x) {
66 for (
size_t j = 0, v = min_y; v < max_y; j++, v += step_y) {
73 pointCloud(i, j).z = depth.
pixel(u, v);
T & pixel(size_t x, size_t y)
size_t width() const
Gets width of image in pixels.
size_t height() const
Gets height of image in pixels.
virtual void resize(size_t width, size_t height)
Resize the PointCloud.
#define yCAssert(component, x)
#define YARP_LOG_COMPONENT(name,...)
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.
The IntrinsicParams struct to handle the intrinsic parameter of cameras(RGB and RGBD either).
double focalLengthY
Result of the product of the physical focal length(mm) and the size sy of the individual imager eleme...
double focalLengthX
Result of the product of the physical focal length(mm) and the size sx of the individual imager eleme...
double principalPointX
Horizontal coordinate of the principal point of the image, as a pixel offset from the left edge.
double principalPointY
Vertical coordinate of the principal point of the image, as a pixel offset from the top edge.