Update the changelog
[opencv] / tests / python / highgui / cvGetCaptureProperty.py
1 #! /usr/bin/env python
2 """
3 This script will test highgui's cvGetCaptureProperty() function
4 """
5
6 # name of this test and it's requirements
7 TESTNAME = "cvGetCaptureProperty"
8 REQUIRED = ["cvCreateFileCapture"]
9
10  
11 # needed for sys.exit(int) and .works file handling
12 import os
13 import sys
14 import works
15
16 # path to imagefiles we need
17 PREFIX=os.environ["top_srcdir"]+"/tests/python/testdata/videos/"
18
19 # check requirements and delete old flag file, if it exists
20 if not works.check_files(REQUIRED,TESTNAME):
21         sys.exit(77)
22
23 # import the necessary things for OpenCV
24 import python
25 from python.highgui import *
26 from python.cv import *
27
28
29 # create a video reader using the tiny video 'vd_uncompressed.avi'
30 video = cvCreateFileCapture(PREFIX+"uncompressed.avi"")
31
32 # retrieve video dimensions and compare with known values
33 print str(cvGetCaptureProperty( video, CV_CAP_PROP_FOURCC ))
34
35 print "Checking image dimensions"
36 if cvGetCaptureProperty( video, CV_CAP_PROP_FRAME_WIDTH ) != 720:
37         sys.exit(1)
38 if cvGetCaptureProperty( video, CV_CAP_PROP_FRAME_HEIGHT ) != 576:
39         sys.exit(1)
40 print "pass"
41
42 print "Checking framerate"
43 if cvGetCaptureProperty( video, CV_CAP_PROP_FPS ) != 25:
44         sys.exit(1)
45 print "pass"
46
47 print str(cvGetCaptureProperty( video, CV_CAP_PROP_FOURCC ) )
48
49 # ATTENTION: We do not release the video reader, window or any image.
50 # This is bad manners, but Python and OpenCV don't care...
51         
52 # create flag file for sollowing tests
53 works.set_file(TESTNAME)
54
55 # return 0 ('PASS')
56 sys.exit(0)