I want to read video file(.avi or .mov) and detect motion and edges using Opencv.Can u help me with code?I want to create a GUI in which we can select the video file,then we can carry out image processing functions in opencv?
相关问题
- Sorting 3 numbers without branching [closed]
- Multiple sockets for clients to connect to
- How to get the background from multiple images by
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
How to read a video file:
How to track/detect motion:
How to detect edges/countours:
cvCanny()
cvCanny()
andcvFindContours()
cvCornerHarris()
And for more info on how to detect shapes, check this post.
This works for me, I'm using
AVI
files. Call video withe filename, in your main-loop get the next frame and shutdown before terminating or changing to another video.Note: Opencv doesn't support audio playback On how to use ffmmpeg with opencv see audio-output-with-video-processing-with-opencv
You should look at the samples included in the python folder for opencv. They will be found here: opencv\samples\python2
There you will find many of the basic and advanced features of opencv (in the cv2 format) demonstrated. There are also many tutorials (mainly in c++) on the website here: http://opencv.itseez.com/doc/tutorials/tutorials.html
Reading and writing video images is here: http://opencv.itseez.com/trunk/modules/highgui/doc/reading_and_writing_images_and_video.html
For initial video capture from AVI:
The shortest example for reading a frame from a video :