2 This script will test highgui's cvQueryFrame() function
3 for different video formats
6 # import the necessary things for OpenCV and comparson routine
9 from python.highgui import *
10 from python.cv import *
13 # path to videos and images we need
14 PREFIX=os.environ["top_srcdir"]+"/tests/python/testdata/"
16 # this is the folder with the videos and images
17 # and name of output window
18 IMAGES = PREFIX+"images/"
19 VIDEOS = PREFIX+"videos/"
21 # testing routine, called for each entry in FILENAMES
22 # and compares each frame with corresponding frame in COMPARISON
23 def query_ok(FILENAME,ERRORS):
25 # create a video reader using the tiny videofile VIDEOS+FILENAME
26 video=cvCreateFileCapture(VIDEOS+FILENAME)
29 # couldn't open video (FAIL)
32 # call cvQueryFrame for 29 frames and check if the returned image is ok
34 image=cvQueryFrame(video)
37 # returned image is NULL (FAIL)
40 if not match.match(image,k,ERRORS[k]):
43 cvReleaseCapture(video)
44 # everything is fine (PASS)