如何使用OpenCV在视频上查找对象 [英] How to find object on video using OpenCV
问题描述
要在视频帧上跟踪对象,首先我从视频中提取图像帧,并将这些图像保存到文件夹。然后我应该处理这些图像来找到一个对象。实际上,我不知道这是否是一个实用的东西,因为所有的算法做到这一步。它是否正确?
那么,你的方法会消耗大量的磁盘空间,取决于视频的大小和
您是否尝试过执行实时视频处理?如果你的算法不是太慢,有一些帖子,显示你需要做的事情:
- 这篇文章演示了如何使用OpenCV的C接口来执行一个函数,将网络摄像头捕获的帧(即时)转换为灰度和在屏幕上显示它们;
- 此post 显示了使用C ++界面检测图片中的正方形的简单方法;
- 这个帖子是上面的稍微变化,并且示出如何检测纸张;
- 此主题显示几种不同的方式来执行高级方形检测。
我相信你能够将代码从C接口转换到C ++接口。 / p>
To track object on video frame, first of all I extract image frames from video and save those images to a folder. Then I am supposed to process those images to find an object. Actually I do not know if this is a practical thing, because all the algorithm did this for one step. Is this correct?
Well, your approach will consume a lot of space on your disk depending on the size of the video and the size of the frames, plus you will spend a considerable amount of time reading frames from the disk.
Have you tried to perform real-time video processing instead? If your algorithm is not too slow, there are some posts that show the things that you need to do:
- This post demonstrates how to use the C interface of OpenCV to execute a function to convert frames captured by the webcam (on-the-fly) to grayscale and displays them on the screen;
- This post shows a simple way to detect a square in an image using the C++ interface;
- This post is a slight variation of the one above, and shows how to detect a paper sheet;
- This thread shows several different ways to perform advanced square detection.
I trust you are capable of converting code from the C interface to the C++ interface.
这篇关于如何使用OpenCV在视频上查找对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!