Reputation: 3
I am loading an image that is .png
, which is 16-bit with 1 channel (depth image from Kinect Sensor).
I want to convert it to an image with 3 channels (color) and 32-bit.
How do I do this ?
Upvotes: 0
Views: 2210
Reputation: 9379
Step 1: 16 --> 32 bits
cv::Mat depthImage:
cv::Mat depth32;
float scaleFactor = 1.0; // Or what you want
depthImage.convertTo(depth32, CV_32F, scaleFactor);
Step 2: 1 ---> 3 channels
#include <opencv2/imgproc/imgproc.hpp>
cv::Mat depthColor32;
cv::cvtColor(depth32, depthColor32, CV_GRAY2BGR);
And that's it.
Upvotes: 2