openCV:如何将视频分割成图像序列?
使用opencv,如何将视频分割成图像序列?
我如何分割它以便输出是图像序列?
Using opencv, how can one split a video into an image sequence?
How can i split it so that the output will be a sequence of images?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
令我惊讶的是,我在 StackoverFlow 上找不到这个问题的答案。
我目前正在使用OpenCV 2.1。这可能有点旧,但它很有魅力。该程序将读取输入文件并在当前文件夹中创建名为 *frame_xx.jpg* 的图像序列
For my surprise, I couldn't find an answer to this question on StackoverFlow.
I'm currently using OpenCV 2.1. This might be a little old but it works like a charm. The program will read an input file and create a sequence of images on the current folder named *frame_xx.jpg*
即使在我编辑之后,这个问题看起来也更像是“发送给我代码”需求,而不是典型的 StackOverflow 问题,OP 提供详细信息并证明他或者她已经认真思考过。
所以我只会给出“一半的答案”......无论如何,我对 OpenCV 的机器学习模块只是中等程度的熟悉,并且几乎不了解库的其余部分。 ;-)
简而言之,伪代码应该像这样,并且实现通常需要提到的 OpenCV 方法。
正如所暗示的,上面需要大量的语法和逻辑工作(例如,弄清楚何时停止,生成各个帧的文件名,当然还要正确声明变量并使用所有指针的正确间接级别;-) 。当然,如果您使用 Python 界面,其中一些工作会变得更容易。
读取和写入图像和视频 OpenCV 文档页面 ,提供有关各个方法的更详细信息。
Even after my edits, the question looks more like a "send-me-the-codez" demand than a typical StackOverflow question whereby the OP provides detailed information and demonstrates that he or she has put some real thought into it.
So I'll just give a "half answer"... Anyway I'm only moderately familiar with OpenCV's machine learning module and barely cognizant of the rest of the library. ;-)
In a nutshell, the pseudo code should look like that and the implementation would typically require the OpenCV methods mentioned.
As hinted the above needs much syntax and logic work (eg. figuring out when to stop, producing the file name of the individual frames, and of course declaring properly the variables and using the right level of indirection w/ all them pointers ;-). Of course some of this is made easier if you use the Python interface.
The Reading and Writing Images and Video OpenCV documentation page, provides more detailed info about the individual methods.