2 This script will test HighGUI's cvGetCaptureProperty functionality
3 for correct returnvalues of width and height information for different video formats
6 # import the necessary things for OpenCV and comparson routine
9 from python.highgui import *
12 # path to images and videos we need
13 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/"
22 # testing routine, seeks through file and compares read images with frames in COMPARISON
23 def size_ok(FILENAME):
24 # create a video reader using the tiny videofile VIDEOS+FILENAME
25 video=cvCreateFileCapture(VIDEOS+FILENAME)
28 # couldn't open video (FAIL)
31 # get width and height information via HighGUI's cvGetCaptureProperty function
32 w=cvGetCaptureProperty(video,CV_CAP_PROP_FRAME_WIDTH)
33 h=cvGetCaptureProperty(video,CV_CAP_PROP_FRAME_HEIGHT)
35 # get an image to compare
36 image=cvQueryFrame(video)
38 if (w!=image.width) or (h!=image.height):
39 # dimensions don't match parameters (FAIL)
44 # everything is fine (PASS)