Using image_transport(ROS pkg) to compress and decompress image
- compress the raw image with png-compressed method(png level=9), because the jpeg-compressed would casue distortion
- decompress the compressed image to raw image
I need to get the sensor_msgs::CompressedImage msg from sensor_msgs::Image msg directly because I want to write the sensor_msgs::CompressedImage msg into rosbag. However, the image_transport package cannot directly transform the raw image to compressed image.
Make sure that the compressed_image_transport and image_transport are installed.
I use the compressed_image_transport to get the sensor_msgs::CompressedImage msg. In addition, I also write the file to convert the compressedImage to sensor_msgs::Image msg.
Using the image_transpot package to get the multiple raw images from the compressed images directly.