ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Could you please tell me how can I access color data?

Is this right?

pct cloud;
rgb.float_value=cloud.points[y*cloud.height+x].data[3];
            ptr[3*x+1] = rgb.Red;
            ptr[3*x+2] = rgb.Green;
            ptr[3*x+3] = rgb.Blue;

where pt and rgb is defined the following.

typedef pcl::PointXYZ        pt; 
typedef pcl::PointCloud<pt> pct;

typedef union
{
  struct /*anonymous*/
  {
    unsigned char Blue;
    unsigned char Green;
    unsigned char Red;
    unsigned char Alpha;
  };
  float float_value;
  long long_value;
} RGBValue;

Could you please tell me how can I access color data?

Is this right?

pct cloud;
rgb.float_value=cloud.points[y*cloud.height+x].data[3];
            ptr[3*x+1] = rgb.Red;
            ptr[3*x+2] = rgb.Green;
            ptr[3*x+3] = rgb.Blue;

where pt and rgb is defined the following.

typedef pcl::PointXYZ        pt; 
typedef pcl::PointCloud<pt> pct;

typedef union
{
  struct /*anonymous*/
  {
    unsigned char Blue;
    unsigned char Green;
    unsigned char Red;
    unsigned char Alpha;
  };
  float float_value;
  long long_value;
} RGBValue;

IplImage *Image1;
uchar* ptr = (uchar*) (Image1->imageData + y * Image1->widthStep);

Could you please tell me how can I access color data?

Is this right?

pct cloud;
rgb.float_value=cloud.points[y*cloud.height+x].data[3];
            ptr[3*x+1] = rgb.Red;
            ptr[3*x+2] = rgb.Green;
            ptr[3*x+3] = rgb.Blue;

where pt pt,rgb,ptr and rgb is image1 are defined the following.

typedef pcl::PointXYZ        pt; 
typedef pcl::PointCloud<pt> pct;

typedef union
{
  struct /*anonymous*/
  {
    unsigned char Blue;
    unsigned char Green;
    unsigned char Red;
    unsigned char Alpha;
  };
  float float_value;
  long long_value;
} RGBValue;

IplImage *Image1;
uchar* ptr = (uchar*) (Image1->imageData + y * Image1->widthStep);