107a5099dd2a1dce9657a256e7274b190ed341dd
[opencv] / tests / python / highgui / cvCaptureFromFile.py
1 #! /usr/bin/env python
2 """
3 This script will test highgui's video reading functionality
4 for a given parameter RAW formats.
5 """
6
7
8 # needed for sys.exit(int) and .works file handling
9 import sys
10 import works
11 from works import *
12
13 #import the necessary things for OpenCV
14 import opencv
15 from opencv.highgui import *
16 from opencv.cv import *
17
18
19 # some defines
20 TESTNAME = "cvCaptureFromFile"
21 REQUIRED = []
22 PREFIX   = "/home/dols/Source/opencv/data/qcif_"
23 EXTENSION= ".avi"
24
25
26 # this functions tries to open a videofile
27 # using the filename PREFIX+FORMAT.EXTENSION  and returns True/False 
28 # on success/fail.
29
30 def video_ok( FORMAT ):
31         
32         # check requirements and delete old .works file
33         if not works.check_files( REQUIRED, TESTNAME+FORMAT ):
34                 return false
35
36         video = cvCaptureFromFile(PREFIX+FORMAT+EXTENSION)
37
38         if video is None:
39                 sys.exit(1)
40
41         works.set_file( TESTNAME+FORMAT )
42         return True