mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-08 02:37:45 +08:00
fixing depth compression
This commit is contained in:
@@ -275,10 +275,16 @@ void rgbdImageToROS(const rtabmap::SensorData & data,
|
|||||||
data.depthOrRightRaw().type()==CV_16UC1?sensor_msgs::image_encodings::TYPE_16UC1:
|
data.depthOrRightRaw().type()==CV_16UC1?sensor_msgs::image_encodings::TYPE_16UC1:
|
||||||
sensor_msgs::image_encodings::TYPE_32FC1;
|
sensor_msgs::image_encodings::TYPE_32FC1;
|
||||||
if(compressImages){
|
if(compressImages){
|
||||||
cvDepth.toCompressedImageMsg(msg.depth_compressed,
|
if(cvDepth.encoding == sensor_msgs::image_encodings::TYPE_16UC1 ||
|
||||||
data.depthOrRightRaw().type()!=CV_16UC1 &&
|
cvDepth.encoding == sensor_msgs::image_encodings::TYPE_32FC1)
|
||||||
data.depthOrRightRaw().type()!=CV_32FC1 &&
|
{
|
||||||
compressionFormat == ".jpg"?cv_bridge::JPG:cv_bridge::PNG);
|
msg.depth_compressed.data = rtabmap::compressImage(cvDepth.image, ".png");
|
||||||
|
msg.depth_compressed.format = "png";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cvDepth.toCompressedImageMsg(msg.depth_compressed, compressionFormat == ".jpg"?cv_bridge::JPG:cv_bridge::PNG);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cvDepth.toImageMsg(msg.depth);
|
cvDepth.toImageMsg(msg.depth);
|
||||||
@@ -520,13 +526,22 @@ void rgbdImagesToROS(const rtabmap::SensorData & data,
|
|||||||
cvDepthORRight.image = cv::Mat(data.depthOrRightRaw(), cv::Range::all(), cv::Range(0,subDepthWidth));
|
cvDepthORRight.image = cv::Mat(data.depthOrRightRaw(), cv::Range::all(), cv::Range(0,subDepthWidth));
|
||||||
cvDepthORRight.header = headers[i];
|
cvDepthORRight.header = headers[i];
|
||||||
|
|
||||||
if(compressImages) {
|
if (compressImages)
|
||||||
cvDepthORRight.toCompressedImageMsg(msg.rgbd_images[i].depth_compressed,
|
{
|
||||||
data.depthOrRightRaw().type()!=CV_16UC1 &&
|
if (cvDepthORRight.encoding == sensor_msgs::image_encodings::TYPE_16UC1 ||
|
||||||
data.depthOrRightRaw().type()!=CV_32FC1 &&
|
cvDepthORRight.encoding == sensor_msgs::image_encodings::TYPE_32FC1)
|
||||||
compressionFormat == ".jpg"?cv_bridge::JPG:cv_bridge::PNG);
|
{
|
||||||
|
|
||||||
|
msg.rgbd_images[i].depth_compressed.data = rtabmap::compressImage(cvDepthORRight.image, ".png");
|
||||||
|
msg.rgbd_images[i].depth_compressed.format = "png";
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
|
cvDepthORRight.toCompressedImageMsg(msg.rgbd_images[i].depth_compressed, compressionFormat == ".jpg" ? cv_bridge::JPG : cv_bridge::PNG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
cvDepthORRight.toImageMsg(msg.rgbd_images[i].depth);
|
cvDepthORRight.toImageMsg(msg.rgbd_images[i].depth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user