How to find object on video using OpenCV

前端 未结 2 1935
孤城傲影
孤城傲影 2021-01-05 01:20

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 objec

相关标签:
2条回答
  • 2021-01-05 01:56

    There is no point in storing frames of a video if you're using OpenCV, as it has really handy methods for capturing frames from a camera/stored video real-time.

    In this post you have an example code for capturing frames from a video.

    Then, if you want to detect objects on those frames, you need to process each frame using a detection algorithm. OpenCV brings some sample code related to the topic. You can try to use SIFT algorithm, to detect a picture, for example.

    0 讨论(0)
  • 2021-01-05 02:11

    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.

    0 讨论(0)
提交回复
热议问题