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
11 #from python.highgui import *
14 # path to images and videos we need
15 PREFIX =os.path.join(os.environ["srcdir"],"../../opencv_extra/testdata/python/")
18 # this is the folder with the videos and images
19 # and name of output window
20 IMAGES = PREFIX+"images/"
21 VIDEOS = PREFIX+"videos/"
24 # testing routine, seeks through file and compares read images with frames in COMPARISON
25 def size_ok(FILENAME):
26 # create a video reader using the tiny videofile VIDEOS+FILENAME
27 video=cvCreateFileCapture(VIDEOS+FILENAME)
30 # couldn't open video (FAIL)
33 # get width and height information via HighGUI's cvGetCaptureProperty function
34 w=cvGetCaptureProperty(video,CV_CAP_PROP_FRAME_WIDTH)
35 h=cvGetCaptureProperty(video,CV_CAP_PROP_FRAME_HEIGHT)
37 # get an image to compare
38 image=cvQueryFrame(video)
43 image = cvCloneImage (image)
45 if (w!=image.width) or (h!=image.height):
46 # dimensions don't match parameters (FAIL)
51 # everything is fine (PASS)