3 This script will test highgui's cvQueryFrame() function
6 # name of this test and it's requirements
7 TESTNAME = "cvQueryFrame"
8 REQUIRED = ["cvGrabFrame","cvRetrieveFrame"]
11 # needed for sys.exit(int) and .works file handling
16 # path to imagefiles we need
17 PREFIX=os.environ["top_srcdir"]+"/tests/python/testdata/videos/"
19 # check requirements and delete old flag file, if it exists
20 if not works.check_files(REQUIRED,TESTNAME):
23 # import the necessary things for OpenCV
25 from python.highgui import *
26 from python.cv import *
29 # create a video reader using the tiny video 'uncompressed.avi'
30 video = cvCreateFileCapture(PREFIX+"uncompressed.avi")
32 # call cvQueryFrame for 30 frames and check if the returned image is ok
34 image = cvQueryFrame( video )
37 # returned image is not a correct IplImage (pointer),
38 # so return an error code
41 # ATTENTION: We do not release the video reader, window or any image.
42 # This is bad manners, but Python and OpenCV don't care...
44 # create flag file for sollowing tests
45 works.set_file(TESTNAME)