Added mono16 format for accepted depth input

This commit is contained in:
Mathieu Labbe
2015-04-28 14:08:34 -04:00
parent bd10f22f29
commit 626350c0df
4 changed files with 14 additions and 10 deletions
+3 -2
View File
@@ -690,9 +690,10 @@ void CoreWrapper::commonDepthCallback(
imageMsg->encoding.compare(sensor_msgs::image_encodings::BGR8) == 0 || imageMsg->encoding.compare(sensor_msgs::image_encodings::BGR8) == 0 ||
imageMsg->encoding.compare(sensor_msgs::image_encodings::RGB8) == 0) || imageMsg->encoding.compare(sensor_msgs::image_encodings::RGB8) == 0) ||
!(depthMsg->encoding.compare(sensor_msgs::image_encodings::TYPE_16UC1) == 0 || !(depthMsg->encoding.compare(sensor_msgs::image_encodings::TYPE_16UC1) == 0 ||
depthMsg->encoding.compare(sensor_msgs::image_encodings::TYPE_32FC1) == 0)) depthMsg->encoding.compare(sensor_msgs::image_encodings::TYPE_32FC1) == 0 ||
depthMsg->encoding.compare(sensor_msgs::image_encodings::MONO16) == 0))
{ {
ROS_ERROR("Input type must be image=mono8,mono16,rgb8,bgr8 and image_depth=32FC1,16UC1"); ROS_ERROR("Input type must be image=mono8,mono16,rgb8,bgr8 and image_depth=32FC1,16UC1,mono16");
return; return;
} }
+4 -3
View File
@@ -98,9 +98,10 @@ public:
image->encoding.compare(sensor_msgs::image_encodings::BGR8) == 0 || image->encoding.compare(sensor_msgs::image_encodings::BGR8) == 0 ||
image->encoding.compare(sensor_msgs::image_encodings::RGB8) == 0) || image->encoding.compare(sensor_msgs::image_encodings::RGB8) == 0) ||
!(depth->encoding.compare(sensor_msgs::image_encodings::TYPE_16UC1)==0 || !(depth->encoding.compare(sensor_msgs::image_encodings::TYPE_16UC1)==0 ||
depth->encoding.compare(sensor_msgs::image_encodings::TYPE_32FC1)==0)) depth->encoding.compare(sensor_msgs::image_encodings::TYPE_32FC1)==0 ||
depth->encoding.compare(sensor_msgs::image_encodings::MONO16)==0))
{ {
ROS_ERROR("Input type must be image=mono8,mono16,rgb8,bgr8 (mono8 recommended) and image_depth=16UC1"); ROS_ERROR("Input type must be image=mono8,mono16,rgb8,bgr8 (mono8 recommended) and image_depth=16UC1,32FC1,mono16");
return; return;
} }
else if(depth->encoding.compare(sensor_msgs::image_encodings::TYPE_32FC1)==0) else if(depth->encoding.compare(sensor_msgs::image_encodings::TYPE_32FC1)==0)
@@ -108,7 +109,7 @@ public:
static bool warned = false; static bool warned = false;
if(!warned) if(!warned)
{ {
ROS_WARN("Input depth type is 32FC1, please use type 16UC1 for depth. The depth images " ROS_WARN("Input depth type is 32FC1, please use type 16UC1 or mono16 for depth. The depth images "
"will be processed anyway but with a conversion. This warning is only be printed once..."); "will be processed anyway but with a conversion. This warning is only be printed once...");
warned = true; warned = true;
} }
+3 -2
View File
@@ -136,9 +136,10 @@ private:
const sensor_msgs::CameraInfoConstPtr& cameraInfo) const sensor_msgs::CameraInfoConstPtr& cameraInfo)
{ {
if(depth->encoding.compare(sensor_msgs::image_encodings::TYPE_16UC1)!=0 && if(depth->encoding.compare(sensor_msgs::image_encodings::TYPE_16UC1)!=0 &&
depth->encoding.compare(sensor_msgs::image_encodings::TYPE_32FC1)!=0) depth->encoding.compare(sensor_msgs::image_encodings::TYPE_32FC1)!=0 &&
depth->encoding.compare(sensor_msgs::image_encodings::MONO16)!=0)
{ {
ROS_ERROR("Input type depth=32FC1,16UC1"); ROS_ERROR("Input type depth=32FC1,16UC1,MONO16");
return; return;
} }
+4 -3
View File
@@ -159,10 +159,11 @@ private:
image->encoding.compare(sensor_msgs::image_encodings::MONO16) ==0 || image->encoding.compare(sensor_msgs::image_encodings::MONO16) ==0 ||
image->encoding.compare(sensor_msgs::image_encodings::BGR8) == 0 || image->encoding.compare(sensor_msgs::image_encodings::BGR8) == 0 ||
image->encoding.compare(sensor_msgs::image_encodings::RGB8) == 0) && image->encoding.compare(sensor_msgs::image_encodings::RGB8) == 0) &&
(imageDepth->encoding.compare(sensor_msgs::image_encodings::TYPE_16UC1)!=0 || !(imageDepth->encoding.compare(sensor_msgs::image_encodings::TYPE_16UC1)==0 ||
imageDepth->encoding.compare(sensor_msgs::image_encodings::TYPE_32FC1)!=0)) imageDepth->encoding.compare(sensor_msgs::image_encodings::TYPE_32FC1)==0 ||
imageDepth->encoding.compare(sensor_msgs::image_encodings::MONO16)==0))
{ {
ROS_ERROR("Input type must be image=mono8,mono16,rgb8,bgr8 and image_depth=32FC1,16UC1"); ROS_ERROR("Input type must be image=mono8,mono16,rgb8,bgr8 and image_depth=32FC1,16UC1,mono16");
return; return;
} }