Ask Your Question
0

VideoCapture not obtaining newest frames when I run read()

asked 2015-12-28 10:33:15 -0600

Hey guys, I'm using a VideoCapture from a C920 to read() the latest/newest images from the camera. I've noticed that unless I'm constantly looping the VideoCapture.read(), that I don't get the newest images but something in a buffer since the picture is clearly "older" than what the current frame should be.

I'm using this with ROS/mavros to command a multicopter to move, if that relates to anything. I might be able to get some code here if what I said doesn't make sense. Has anyone heard of this happening? Is there another way to grab the newest image from the camera?

Thanks!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-01-03 20:02:04 -0600

harsha gravatar image

updated 2016-01-03 20:17:10 -0600

If you're using ROS, it might be better to use usb_cam package to open a usb camera. You can subscribe to the image topic, use cv_bridge to convert sensor_msgs::image to cv::Mat, process your image and publish or send service calls from there. This way you'll always get the latest frame for your callback.

edit flag offensive delete link more

Comments

So, there's not anything "wrong" happening with the video capture? Or is this just a way to circumvent the issue? I'll try this, but I'm using Python instead of C++.

warblegarblegarble gravatar imagewarblegarblegarble ( 2016-01-04 08:46:05 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-12-28 10:33:15 -0600

Seen: 261 times

Last updated: Jan 03 '16