简体   繁体   English

在OpenCV和ROS中逐帧记录视频

[英]Record video frame by frame in OpenCV and ROS

I have a heavy program that I receive a message of ROS(an image) in a callback and I process it. 我有一个沉重的程序,我在回调中收到ROS(图像)消息,并对其进行处理。 I'd like to run the program frame per frame because I don't want to lose no frames and I'd like to save in a Video file with a certain frequency. 我想每帧运行一个程序,因为我不想丢失任何帧,并且希望以一定的频率保存在视频文件中。 Can anyone help me? 谁能帮我?

Not sure what your problem exactly is. 不知道您的问题到底是什么。 If it's just about storing the processed images you can save them with the OpenCV cv::imwrite . 如果仅用于存储处理后的图像,则可以使用OpenCV cv :: imwrite保存它们。 The other option is to use the VideoWriter to encode the images in a video file. 另一个选择是使用VideoWriter将图像编码为视频文件。 There you can specify the frames per second and the encoding as shown in the example. 您可以在那里指定每秒的帧数和编码,如示例中所示。

Cheers 干杯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM