Video files in opencv

前端 未结 4 676
南方客
南方客 2021-02-04 22:37

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

4条回答
  •  借酒劲吻你
    2021-02-04 23:24

    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:

    import cv2
    import cv2.cv as cv
    import numpy as np
    
    cap = cv2.VideoCapture(filename)
    img = cv2.VideoCapture.read()
    if img:
       print img.get(cv.CV_CAP_PROP_FRAME_HEIGHT)
       print type(img)
    # loop through rest of frames reading one at a time
    

提交回复
热议问题