Hi,
You could create a node in Python to subscribe to RGBDimage topic and then just republish the rgb image (raw or compressed).
#!/usr/bin/env python
import rospy
from sensor_msgs.msg import CameraInfo
from sensor_msgs.msg import Image
from sensor_msgs.msg import CompressedImage
from rtabmap_ros.msg import RGBDImage
def callback(msg):
global info_pub
global image_pub
global compressed_pub
info_pub.publish(msg.rgb_camera_info)
if len(msg.rgb.data) > 0:
image_pub.publish(msg.rgb)
if len(msg.rgb_compressed.data) > 0:
compressed_pub.publish(msg.rgb_compressed)
if __name__ == "__main__":
rospy.init_node("rgbd_to_image", anonymous=True)
rospy.Subscriber("rgbd_image", RGBDImage, callback, queue_size=1)
info_pub = rospy.Publisher(rospy.resolve_name("rgbd_image") + "/camera_info", CameraInfo, queue_size=1)
image_pub = rospy.Publisher(rospy.resolve_name("rgbd_image")+ "/image", Image, queue_size=1)
compressed_pub = rospy.Publisher(rospy.resolve_name("rgbd_image") + "/image/compressed", CompressedImage, queue_size=1)
rospy.spin()
Usage:
python rgbd_to_image.py rgbd_image:=/rtabmap/rgbd_image