I am reading an image from a simulated camera placed somewhere in the world. What I would like to do is to pack the image data into a base64 encoded string and send it to another application. Here is how I try to do it:
void callback(ConstImageStampedPtr& _msg)
int width = _msg->image().width(); int height = _msg->image().height(); std::string data = _msg->image().data(); std::string encoded = base64_encode(data); msg.data = encoded; pub.publish(msg);
The problem is that the string that I get does not seem to be a valid image. I would like to understand in what form the image is stored in the message and how I can get it from there.