9 #ifndef YARP_SIG_POINTCLOUDUTILS_INL_H
10 #define YARP_SIG_POINTCLOUDUTILS_INL_H
12 #include <type_traits>
19 std::enable_if_t<std::is_same<T1, yarp::sig::DataXYZRGBA>::value &&
20 (std::is_same<T2, yarp::sig::PixelRgb>::value ||
21 std::is_same<T2, yarp::sig::PixelBgr>::value),
int> = 0
28 pointCloud(u,v).r = color.
pixel(u,v).r;
29 pointCloud(u,v).g = color.
pixel(u,v).g;
30 pointCloud(u,v).b = color.
pixel(u,v).b;
35 std::enable_if_t<std::is_same<T1, yarp::sig::DataXYZRGBA>::value &&
36 (std::is_same<T2, yarp::sig::PixelRgba>::value ||
37 std::is_same<T2, yarp::sig::PixelBgra>::value),
int> = 0
44 pointCloud(u,v).r = color.
pixel(u,v).r;
45 pointCloud(u,v).g = color.
pixel(u,v).g;
46 pointCloud(u,v).b = color.
pixel(u,v).b;
47 pointCloud(u,v).a = color.
pixel(u,v).a;
52 std::enable_if_t<!std::is_same<T1, yarp::sig::DataXYZRGBA>::value ||
53 (!std::is_same<T2, yarp::sig::PixelRgb>::value &&
54 !std::is_same<T2, yarp::sig::PixelBgr>::value &&
55 !std::is_same<T2, yarp::sig::PixelRgba>::value &&
56 !std::is_same<T2, yarp::sig::PixelBgra>::value),
int> = 0
67 template<
typename T1,
typename T2>
76 size_t w = depth.
width();
81 for (
size_t u = 0; u < w; ++u) {
82 for (
size_t v = 0; v < h; ++v) {
90 pointCloud(u,v).z = depth.
pixel(u,v);
92 copyColorData(pointCloud, color, 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.
yarp::sig::PointCloud< T1 > depthRgbToPC(const yarp::sig::ImageOf< yarp::sig::PixelFloat > &depth, const yarp::sig::ImageOf< T2 > &color, const yarp::sig::IntrinsicParams &intrinsic)
depthRgbToPC, compute the colored PointCloud given depth image, color image and the intrinsic paramet...
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.