const cv::Mat depth_img =
cv_bridge::toCvCopy(msg->depth_image,
sensor_msgs::image_encodings::TYPE_16UC1)
->image;
cv::Mat dep(depth_img.rows, depth_img.cols, CV_32FC1, depth_img.data);
now dep
has size [1408, 1024], but I want it to have a channel in the last dimension, i.e. size [1408, 1024, 1]. how should I do this?
I’ve read many stackoverflow answers and they talk about merge
, but I don’t really need it since I only need it to be one channel.