Skip to content

Instantly share code, notes, and snippets.

@UnaNancyOwen UnaNancyOwen/color.cpp
Last active Feb 7, 2018

Embed
What would you like to do?
// Retrrieve Flame
rs2::video_frame color_frame = frameset.get_color_frame();
// Retrieve Flame Size
const uint32_t color_width = color_frame.as<rs2::video_frame>().get_width();
const uint32_t color_height = color_frame.as<rs2::video_frame>().get_height();
// Retrive Data
const uint8_t* color_data = reinterpret_cast<const uint8_t*>( color_frame.get_data() );
// Access to Pixel
for( uint32_t y = 0; y < color_height; y++ ){
const uint32_t offset = y * color_width;
for( uint32_t x = 0; x < color_width; x++ ){
const uint8_t b = color_data[offset + x + 0];
const uint8_t g = color_data[offset + x + 1];
const uint8_t r = color_data[offset + x + 2];
}
}
// Retrrieve Flame
rs2::depth_frame depth_frame = frameset.get_depth_frame();
// Retrieve Flame Size
const uint32_t depth_width = depth_frame.as<rs2::video_frame>().get_width();
const uint32_t depth_height = depth_frame.as<rs2::video_frame>().get_height();
// Retrive Data
const uint16_t* depth_data = reinterpret_cast<const uint16_t*>( depth_frame.get_data() );
// Access to Pixel
for( uint32_t y = 0; y < depth_height; y++ ){
const uint32_t offset = y * depth_width;
for( uint32_t x = 0; x < depth_width; x++ ){
const uint16_t pixel = depth_data[offset + x];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.