ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Extract last 2 frames from camera

asked 2021-06-23 19:38:50 -0500

guiaugustoga gravatar image

Hello,

How do I extract multiple frames from a video streaming using ROS ?

I subscribed to my camera topic :

 self.image_sub = rospy.Subscriber('/bebop2/image_raw',Image, self.image_callback)

And then :

frame = self.bridge.imgmsg_to_cv2(msg,desired_encoding='bgr8')

This way I have the actual frame from my streaming. How can I store N frames (the actual and previous ones) ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-06-24 02:28:56 -0500

gvdhoorn gravatar image

This can be done using either local variables (ie: store incoming messages in variables in the scope outside the callback), or (and this would be preferable): use message_filters/Cache:

Stores a time history of messages.

Given a stream of messages, the most recent N messages are cached in a ring buffer, from which time intervals of the cache can then be retrieved by the client. The timestamp of a message is determined from its header field.

You tagged this rospy, but just to mention them: fkie_message_filters offers an improved version of message_filters but is C++, and fetchrobotics/flow_ros is an even more complex/complete implementation of something which could still be considered similar to message_filters.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-06-23 19:38:50 -0500

Seen: 100 times

Last updated: Jun 24 '21