Conversion from 32FC1 to mono8 using cv_bridge
I am trying to use cv_bridge to convert an image from /disp_map/image
(32FC1 encoding according to msg->encoding
) to an image usable in opencv with the following code :
void detectionCallback(const sensor_msgs::ImageConstPtr& msg) {
cv_bridge::CvImagePtr cv_ptr;
try
{
cv_ptr = cv_bridge::toCvCopy(msg, "mono8");
}
catch (cv_bridge::Exception& e)
{
ROS_ERROR("cv_bridge exception: %s", e.what());
return;
}
}
And i get the following error :
[ERROR] [1499238883.621456903]: cv_bridge exception: [32FC1] is not a color format. but [mono8] is. The conversion does not make sense
What's the best solution to solve this ?