ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Is our depth image already 8 Bit? Otherwise you'll have to find a smart way to scale it to 8 Bit, which might be tricky;)
Assuming your depth image is cv::Mat of type CV_8UC1 and your RGB image is cv::Mat of type CV_8UC3 with color space BGR it is quite easy ():
std::vector<cv::Mat> channels;
// split the channels
cv::splt( rgb_image, channels );
// blend depth image into each channel
channels[ 0 ] = (channels[ 0 ] * 0.5) + ( depth_image * 0.5 );
channels[ 1 ] = (channels[ 1 ] * 0.5) + ( depth_image * 0.5 );
channels[ 2 ] = (channels[ 2 ] * 0.5) + ( depth_image * 0.5 );
// merge to overlayed image
cv::Mat blended;
cv::merge( channels, blended );
2 | No.2 Revision |
Is our depth image already 8 Bit? Otherwise you'll have to find a smart way to scale it to 8 Bit, which might be tricky;)
Assuming your depth image is cv::Mat of type CV_8UC1 and your RGB image is cv::Mat of type CV_8UC3 with color space BGR it is quite easy ():easy:
std::vector<cv::Mat> channels;
// split the channels
cv::splt( rgb_image, channels );
// blend depth image into each channel
channels[ 0 ] = (channels[ 0 ] * 0.5) + ( depth_image * 0.5 );
channels[ 1 ] = (channels[ 1 ] * 0.5) + ( depth_image * 0.5 );
channels[ 2 ] = (channels[ 2 ] * 0.5) + ( depth_image * 0.5 );
// merge to overlayed image
cv::Mat blended;
cv::merge( channels, blended );
3 | No.3 Revision |
Is our depth image already 8 Bit? Otherwise you'll have to find a smart way to scale it to 8 Bit, which might be tricky;)
Assuming your depth image is cv::Mat of type CV_8UC1 and your RGB image is cv::Mat of type CV_8UC3 with color space BGR it is quite easy:
std::vector<cv::Mat> channels;
// split the channels
cv::splt( cv::split( rgb_image, channels );
// blend depth image into each channel
channels[ 0 ] = (channels[ 0 ] * 0.5) + ( depth_image * 0.5 );
channels[ 1 ] = (channels[ 1 ] * 0.5) + ( depth_image * 0.5 );
channels[ 2 ] = (channels[ 2 ] * 0.5) + ( depth_image * 0.5 );
// merge to overlayed image
cv::Mat blended;
cv::merge( channels, blended );