Skip to content

Commit 44f9d93

Browse files
authored
Merge pull request #732 from stereolabs/fix_openni_mode
Fix sensor_msgs type for depth image in OpenNI mode
2 parents ef7f147 + 1d5d5ef commit 44f9d93

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

latest_changes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
LATEST CHANGES
22
==============
33

4+
OpenNI mode fix (2021-06-15)
5+
----------------------------
6+
- Fix sensor_msgs type for depth image in OpenNI mode, from `sensor_msgs::image_encodings::mono16` to `sensor_msgs::image_encodings::TYPE_16UC1`. Depth image in OpenNI mode is now compatible with the nodelet `depthimage_to_laserscan`
7+
48
v3.5.x
59
---------
610
- Add support for ROS Noetic

zed_nodelets/src/tools/src/sl_tools.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void imageToROSmsg(sensor_msgs::ImagePtr imgMsgPtr, sl::Mat img, std::string fra
238238
break;
239239

240240
case sl::MAT_TYPE::U16_C1: /**< unsigned short 1 channel.*/
241-
imgMsgPtr->encoding = sensor_msgs::image_encodings::MONO16;
241+
imgMsgPtr->encoding = sensor_msgs::image_encodings::TYPE_16UC1;
242242
memcpy((uint16_t*)(&imgMsgPtr->data[0]), img.getPtr<sl::ushort1>(), size);
243243
break;
244244
}

zed_nodelets/src/zed_nodelet/src/zed_wrapper_nodelet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void ZEDWrapperNodelet::onInit()
129129

130130
if (mOpenniDepthMode)
131131
{
132-
NODELET_INFO_STREAM("Openni depth mode activated -> Units: mm, Encoding: MONO16");
132+
NODELET_INFO_STREAM("Openni depth mode activated -> Units: mm, Encoding: TYPE_16UC1");
133133
}
134134
depth_topic_root += "/depth_registered";
135135

@@ -1912,7 +1912,7 @@ void ZEDWrapperNodelet::publishDepth(sensor_msgs::ImagePtr imgMsgPtr, sl::Mat de
19121912
imgMsgPtr->is_bigendian = !(*(char*)&num == 1);
19131913

19141914
imgMsgPtr->step = imgMsgPtr->width * sizeof(uint16_t);
1915-
imgMsgPtr->encoding = sensor_msgs::image_encodings::MONO16;
1915+
imgMsgPtr->encoding = sensor_msgs::image_encodings::TYPE_16UC1;
19161916

19171917
size_t size = imgMsgPtr->step * imgMsgPtr->height;
19181918
imgMsgPtr->data.resize(size);

0 commit comments

Comments
 (0)