wrappers/pcl/pcl-color/rs-pcl-color.cpp
//======================================================
// RGB Texture
// - Function is utilized to extract the RGB data from
// a single point return R, G, and B values. 
// Normals are stored as RGB components and
// correspond to the specific depth (XYZ) coordinate.
// By taking these normals and converting them to
// texture coordinates, the RGB components can be
// "mapped" to each individual point (XYZ).
//======================================================
RGB Texture
Function is utilized to extract the RGB data from
a single point return R, G, and B values.
Normals are stored as RGB components and
correspond to the specific depth (XYZ) coordinate.
By taking these normals and converting them to
texture coordinates, the RGB components can be
"mapped" to each individual point (XYZ).
RGB Texture Function is utilized to extract the RGB data from a single point return R G and B values . Normals are stored as RGB components and correspond to the specific depth ( XYZ ) coordinate . By taking these normals and converting them to texture coordinates the RGB components can be " mapped " to each individual point ( XYZ ) .
std::tuple<int, int, int> RGB_Texture(rs2::video_frame texture, rs2::texture_coordinate Texture_XY)
{
    int width  = texture.get_width();  
    int height = texture.get_height(); 
    int x_value = min(max(int(Texture_XY.u * width  + .5f), 0), width - 1);
    int y_value = min(max(int(Texture_XY.v * height + .5f), 0), height - 1);
    int bytes = x_value * texture.get_bytes_per_pixel();   
    int strides = y_value * texture.get_stride_in_bytes(); 
    int Text_Index =  (bytes + strides);
    const auto New_Texture = reinterpret_cast<const uint8_t*>(texture.get_data());
    int NT1 = New_Texture[Text_Index];
    int NT2 = New_Texture[Text_Index + 1];
    int NT3 = New_Texture[Text_Index + 2];
    return std::tuple<int, int, int>(NT1, NT2, NT3);
}
std :: tuple < int , int , int > RGB_Texture ( rs2 :: video_frame texture , rs2 :: texture_coordinate Texture_XY ) { int width = texture . get_width ( ) ; int height = texture . get_height ( ) ; int x_value = min ( max ( int ( Texture_XY . u * width + .5f ) , 0 ) , width - 1 ) ; int y_value = min ( max ( int ( Texture_XY . v * height + .5f ) , 0 ) , height - 1 ) ; int bytes = x_value * texture . get_bytes_per_pixel ( ) ; int strides = y_value * texture . get_stride_in_bytes ( ) ; int Text_Index = ( bytes + strides ) ; const auto New_Texture = reinterpret_cast < const uint8_t * > ( texture . get_data ( ) ) ; int NT1 = New_Texture [ Text_Index ] ; int NT2 = New_Texture [ Text_Index + 1 ] ; int NT3 = New_Texture [ Text_Index + 2 ] ; return std :: tuple < int , int , int > ( NT1 , NT2 , NT3 ) ; }
RGB Texture
 Function is utilized to extract the RGB data from
a single point return R, G, and B values.
RGB Texture Function is utilized to extract the RGB data from a single point return R G and B values .
// Get Width and Height coordinates of texture // Frame width in pixels // Frame height in pixels // Normals to Texture Coordinates conversion // Get # of bytes per pixel // Get line width in bytes // RGB components to save in tuple