ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Assumin 8UC3 rgb image, and 16UC1 deph image, this is what I use for saving and loading:

// save images 
cv::imwrite("rgb.png",   rgb_img);
cv::imwrite("depth.png", depth_img);

// load images
rgb_img = cv::imread("rgb.png");
depth_img = cv::imread("depth.png", -1);

I believe the crucial part is the -1 flag. From the imread page:

flags: <0 Return the loaded image as is (with alpha channel).

Assumin Assuming 8UC3 rgb image, and 16UC1 deph image, this is what I use for saving and loading:

// save images 
cv::imwrite("rgb.png",   rgb_img);
cv::imwrite("depth.png", depth_img);

// load images
rgb_img = cv::imread("rgb.png");
depth_img = cv::imread("depth.png", -1);

I believe the crucial part is the -1 flag. From the imread page:

flags: <0 Return the loaded image as is (with alpha channel).

Assuming 8UC3 rgb image, and 16UC1 deph depth image, this is what I use for saving and loading:

// save images 
cv::imwrite("rgb.png",   rgb_img);
cv::imwrite("depth.png", depth_img);

// load images
rgb_img = cv::imread("rgb.png");
depth_img = cv::imread("depth.png", -1);

I believe the crucial part is the -1 flag. From the imread page:

flags: <0 Return the loaded image as is (with alpha channel).