Last active
February 7, 2018 17:47
-
-
Save UnaNancyOwen/1d0848ee25b26346a719ec6d0dd1d532 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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