Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 475

Subscribing to compressed Images from rosbag

$
0
0
Hello, I have a rosbag file with compressed images recorded. The rosbag file is publishing the topic: "/xxxx/image_raw/compressed" of type "sensor_msgs/CompressedImage". I want to write the subscriber in python. I saw the following example from ROS wiki for subscribing the normal messages from chatter topic. #!/usr/bin/env python import rospy from std_msgs.msg import String def callback(data): rospy.loginfo(rospy.get_caller_id() + 'I heard %s', data.data) def listener(): rospy.init_node('listener', anonymous=True) rospy.Subscriber('chatter', String, callback) rospy.spin() if __name__ == '__main__': listener() I have changed it as: #!/usr/bin/env python import rospy from sensor_msgs.msg import CompressedImage def callback(data): rospy.loginfo(rospy.get_caller_id() + 'I heard %s', data.data) def listener(): rospy.init_node('image_subscriber', anonymous=True) rospy.Subscriber('/xxxx/image_raw/compressed', CompressedImage, callback) rospy.spin() if __name__ == '__main__': listener() Where should I make more changes so that it will subscribe to the topic /xxxx/image_raw/compressed and save images to the disk. Please, provide me some guidelines. Thanks! ARM

Viewing all articles
Browse latest Browse all 475

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>