3 This script will test highgui's cvRetrieveFrame function
6 # name of this test and it's requirements
7 TESTNAME = "cvRetrieveFrame"
8 REQUIRED = ["cvGrabFrame"]
11 # needed for sys.exit(int) and .works file handling
16 # path to imagefiles we need
17 PREFIX=os.path.join(os.environ["srcdir"],"../../opencv_extra/testdata/python/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
28 # create a video reader using the tiny video 'uncompressed.avi'
29 video = cvCreateFileCapture(PREFIX+"uncompressed.avi")
31 # call cvGrabFrame to grab a frame from video
32 res=cvGrabFrame(video)
35 print "(ERROR) Couldn't call cvGrabFrame()"
37 # call cvRetrieveFrame and check if returned image is valid
38 image = cvRetrieveFrame(video)
41 # returned image is not a correct IplImage (pointer),
42 # so return an error code
46 # ATTENTION: We do not release the video reader or image.
47 # This is bad manners, but Python and OpenCV don't care...
49 # create flag file for sollowing tests
50 works.set_file(TESTNAME)