3 This script will test highgui's video reading functionality
6 # name of this test and it's requirements
7 TESTNAME = "cvGrabFrame"
8 REQUIRED = ["cvCreateFileCaptureRGBA"]
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/"
20 # check requirements and delete old flag file, if it exists
21 if not works.check_files(REQUIRED,TESTNAME):
24 # import the necessary things for OpenCV
26 from python.highgui import *
27 from python.cv import *
30 # create a video reader using the tiny video 'uncompressed.avi'
31 video = cvCreateFileCapture(PREFIX+"uncompressed.avi")
33 # call cvGrabFrame to grab a frame and save return value
34 res = cvGrabFrame(video)
37 print "(ERROR) Couldn't call cvGrabFrame()."
40 # ATTENTION: We do not release the video reader, window or any image.
41 # This is bad manners, but Python and OpenCV don't care...
43 # create flag file for sollowing tests
44 works.set_file(TESTNAME)