Ask Your Question

Revision history [back]

image_transport provides transparent transport of images in compressed formats. This transparency means that on the subscriber side in the callback, you receive a sensor_msgs::Image regardless of which transport has actually been used. That's a feature, because this way, the transport can be transparently exchanged, without any need for code modifications on the consumer side.

Things should hence work if you change your callback to

void savingImagesCb(const sensor_msgs::ImageConstPtr& msg)

If you actually want to receive the compressed image, using a plain subscriber on the compressed topic directly should work (e.g. subscriber to /camera/image_raw/compressed for instance).