Edit encoding of sensor_msgs/Image message
I have a sensor_msgs/Image message that I'm unable to use with standard ROS packages like stereo_image_proc because the "encoding" is described as "8UC1". I want it to be interpreted as "mono8" and want to change the string in the "encoding" parameter of the message.
void imageCallback(sensor_msgs::ImageConstPtr& msg)
{
ROS_INFO("Message received");
msg->encoding.at<std::string>(0,0) = "mono8";
}
When I do it like above I get the error message "type name is not allowed" when compiling. I have tried all sorts of alternatives but can't seem to find it out. Can anyone help me on this?