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

ROSBAG overriding Extracted Images

$
0
0
Hello, I have a rosbag file which contain images. I am extracting images through the following subscriber. I extract only one image. I thing it is replacing every new image with the old one. I need to save all images. Can you point me out where should I make changes. #! /usr/bin/python import rospy from sensor_msgs.msg import Image from cv_bridge import CvBridge, CvBridgeError import cv2 bridge = CvBridge() def image_callback(msg): print("Received an image!") try: cv2_img = bridge.imgmsg_to_cv2(msg, "bgr8") except CvBridgeError, e: print(e) else: cv2.imwrite('~/rec_images/frame.jpeg', cv2_img) def main(): rospy.init_node('img_listener') image_topic = "/xxxx/image_raw/raw" rospy.Subscriber(image_topic, Image, image_callback) rospy.spin() if __name__ == '__main__': main()

Viewing all articles
Browse latest Browse all 475

Trending Articles



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