Skip to content

Commit

Permalink
add Point types with label field for the pcl people library
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.pointclouds.org/pcl/trunk@2995 a9d63959-f2ad-4865-b262-bf0e56cfafb6
  • Loading branch information
KoenBuys committed Oct 31, 2011
1 parent 0257991 commit 5dfaeef
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 1 deletion.
68 changes: 67 additions & 1 deletion common/include/pcl/impl/point_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@
#define PCL_POINT_TYPES \
(pcl::PointXYZ) \
(pcl::PointXYZI) \
(pcl::PointXYZL) \
(pcl::PointXYZRGBA) \
(pcl::PointXYZRGB) \
(pcl::PointXYZRGBL) \
(pcl::PointXYZHSV) \
(pcl::PointXY) \
(pcl::InterestPoint) \
Expand Down Expand Up @@ -72,8 +74,10 @@
#define PCL_XYZ_POINT_TYPES \
(pcl::PointXYZ) \
(pcl::PointXYZI) \
(pcl::PointXYZL) \
(pcl::PointXYZRGBA) \
(pcl::PointXYZRGB) \
(pcl::PointXYZRGBL) \
(pcl::PointXYZHSV) \
(pcl::InterestPoint) \
(pcl::PointNormal) \
Expand All @@ -83,6 +87,11 @@
(pcl::PointWithViewpoint) \
(pcl::PointWithScale)

// Define all point types with XYZ and label
#define PCL_XYZL_POINT_TYPES \
(pcl::PointXYZL) \
(pcl::PointXYZRGBL)

// Define all point types that include normal[3] data
#define PCL_NORMAL_POINT_TYPES \
(pcl::Normal) \
Expand Down Expand Up @@ -237,6 +246,25 @@ namespace pcl
return (os);
}

struct EIGEN_ALIGN16 PointXYZL
{
PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
union
{
struct
{
uint8_t label;
};
uint32_t data_l;
};
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
inline std::ostream& operator << (std::ostream& os, const PointXYZL& p)
{
os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.label << ")";
return (os);
}

/** \brief A point structure representing Euclidean xyz coordinates, and the RGBA color.
*
* The RGBA information is available either as separate r, g, b, or as a
Expand Down Expand Up @@ -313,6 +341,23 @@ namespace pcl
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};

struct EIGEN_ALIGN16 _PointXYZRGBL
{
PCL_ADD_POINT4D; // Thi adds the members x,y,z which can also be accessed using the point (which is float[4])
union
{
struct
{
uint8_t b;
uint8_t g;
uint8_t r;
uint8_t label;
};
uint32_t rgba;
};
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};

/** \brief A point structure representing Euclidean xyz coordinates, and the RGB color.
*
* Due to historical reasons (PCL was first developed as a ROS package), the
Expand Down Expand Up @@ -367,7 +412,28 @@ namespace pcl
};
inline std::ostream& operator << (std::ostream& os, const PointXYZRGB& p)
{
os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.rgb << ")";
os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.r << "," << p.g << "," << p.b << ")";
return (os);
}

struct EIGEN_ALIGN16 PointXYZRGBL : public _PointXYZRGBL
{
inline PointXYZRGBL ()
{
label = 255;
}
inline PointXYZRGBL (uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _label)
{
r = _r;
g = _g;
b = _b;
label = _label;
}
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
inline std::ostream& operator << (std::ostream& os, const PointXYZRGBL& p)
{
os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.r << "," << p.g << "," << p.b << " - " << p.label << ")";
return (os);
}

Expand Down
22 changes: 22 additions & 0 deletions common/include/pcl/point_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,18 @@ namespace pcl
struct PointXYZI;
// Members: float x, y, z, intensity;

struct PointXYZL;
// Members: float x, y, z, uin8_t label;

struct PointXYZRGBA;
// Members: float x, y, z; uint32_t rgba;

struct PointXYZRGB;
// Members: float x, y, z, rgb;

struct PointXYZRGBL;
// Members: float x, y, z, rgb, uint8_t label;

struct PointXYZHSV;
// Members: float x, y, z, h, s, v;

Expand Down Expand Up @@ -222,6 +228,15 @@ POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGB,
)
POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGB, pcl::_PointXYZRGB)

POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBL,
(float, x, x)
(float, y, y)
(float, z, z)
(uint32_t, rgba, rgba)
(uint8_t, label, label)
)
POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBL, pcl::_PointXYZRGBL)

POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZHSV,
(float, x, x)
(float, y, y)
Expand Down Expand Up @@ -251,6 +266,13 @@ POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZI,
(float, intensity, intensity)
)

POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZL,
(float, x, x)
(float, y, y)
(float, z, z)
(uint8_t, label, label)
)

POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Normal,
(float, normal_x, normal_x)
(float, normal_y, normal_y)
Expand Down

0 comments on commit 5dfaeef

Please sign in to comment.