Python Class OpenCV

Introduction

OpenCV (Open Source Computer Vision) is a library of programming functions mainly aimed at real-time computer vision. (Wikipedia)

Links

Install OpenCV on Ubuntu-Debin

OpenCV Home
wikipedia.org/wiki/OpenCV (Wikipedia)
OpenCV Tutorial
A Set of Basic OpenCV Tutorials
OpenCV Tutorial
Getting Started with Videos

Download Sample Videos for Testing

Sample Code

Code from: Watch Video in Python with OpenCV

# ===================================================================
#
# Use Python 2.7
# ===================================================================

import cv

vidFile = cv.CaptureFromFile('SampleVideo_1280x720_10mb.mp4')

nFrames = int(cv.GetCaptureProperty(vidFile, cv.CV_CAP_PROP_FRAME_COUNT))
fps = cv.GetCaptureProperty(vidFile,cv.CV_CAP_PROP_FPS)
waitPerFrameInMillisec = int(1/fps * 1000/1)

print 'Num. Frames = ', nFrames
print 'Frame Rate = ', fps, ' frames per sec'

for f in xrange(nFrames):
    frameImg = cv.QueryFrame(vidFile)
    cv.ShowImage("My Video Window",frameImg)
    cv.WaitKey(waitPerFrameInMillisec)

# When playing is done, delete the window
#  Note: this step is not strictly necessary, 
#        when the script terminates it will
#        close all windows it owns anyways

cv.DestroyWindow("My Video Window")