|
Hello everyone,
I still don´t get how the rgb information is encoded in the pcd file. I would like to be able to seperately extract "xyz" and "rgb. When I open a pcd file with rgb values, I get for example: 1.28125 577.09375 197.9375 1.8807908e-038 828.125 599.03125 491.375 1.8807908e-038 358.6875 917.4375 842.5625 1.8807908e-038 I assume the first three rows are xyz and the last contains rgb. Now before You throw Your eggs/pies/spears, I looked into http://docs.pointclouds.org/1.3.0/structpcl_1_1_r_g_b.html, but I don´t get it. int rgb = ...; uint8_t r = (rgb >> 16) & 0x0000ff; uint8_t g = (rgb >> 8) & 0x0000ff; uint8_t b = (rgb) & 0x0000ff; ^Is that how the last row is built? |
1.28125 577.09375 197.9375 1.8807908e-038 So the RGB is encoded in the 1.8807908e-038, right? I would like to know how the color is encoded in this number. Am I even looking into the right direction? |
|
It's bitshifted (http://www.functionx.com/cpp/Lesson11.htm skip to Bit
Shift Operators: The Left Shift <<) The RGBA information is available either as separate r, g, b, or as a packed uint32_t rgba value. To pack it, use: int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b); To unpack it use: int rgb = ...; uint8_t r = (rgb >> 16) & 0x0000ff; uint8_t g = (rgb >> 8) & 0x0000ff; uint8_t b = (rgb) & 0x0000ff; On 26 January 2012 14:18, goekhan <[hidden email]> wrote: > > > So the RGB is encoded in the , right? > > I would like to know how the color is encoded in this number. Am I even > looking into the right direction? > > -- > View this message in context: http://www.pcl-users.org/PCD-file-format-xyzrgb-tp3685215p3690415.html > Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com. > _______________________________________________ > [hidden email] / http://pointclouds.org > http://pointclouds.org/mailman/listinfo/pcl-users [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users |
|
Thank You koen buys-2 !
I obviously didn´t know about bitshifting.
|
|
Hi,
maybe using a union like in openni-grabber e.g.: typedef union { struct { unsigned char Blue; unsigned char Green;
unsigned char Red; unsigned char Alpha; }; float float_value; uint32_t long_value; } RGBValue;
is more convenient. If the color information is given as float, just assign it to the float_value and read the RGB channels. e.g. RGBValue rgb; ... rgb.float_value = value;
... do-something-with-color (rgb.Red, rgb.Green, rgb.Blue, rgb.Alpha) -Suat On Thu, Jan 26, 2012 at 9:02 AM, goekhan <[hidden email]> wrote: Thank You koen buys-2 ! _______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users |
|
Soz to necro post but it applies to this question.
Is this a good value for a color: 1.00511523e-038 ??? |
|
Hi,
> Is this a good value for a color: 1.00511523e-038 yeah this should be fine, its rgb packed into a float value: so 1.00511523e-038 = 0x006D7286 Channel Hex Dec R = 6D = 109 G = 72 =115 B = 86 = 134 Should be something grayish. I'm not 100% sure its RGB and not BGR as OpenCV uses it. Alex _______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pcl-users |
| Powered by Nabble | Edit this page |
