3 This script will test highgui's window functionality
6 # name of this test and it's requirements
7 TESTNAME = "cvShowImage"
8 REQUIRED = ["cvLoadImagejpg", "cvNamedWindow"]
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/images/")
19 # check requirements and delete old flag file, if it exists
20 if not works.check_files(REQUIRED,TESTNAME):
24 # import the necessary things for OpenCV
29 win_name = "testing..."
31 # we expect a window to be createable, thanks to 'cvNamedWindow.works'
32 cvNamedWindow(win_name, CV_WINDOW_AUTOSIZE)
34 # we expect the image to be loadable, thanks to 'cvLoadImage.works'
35 image = cvLoadImage(PREFIX+"cvShowImage.jpg")
38 print "(ERROR) Couldn't load image "+PREFIX+"cvShowImage.jpg"
41 # try to show image in window
42 res = cvShowImage( win_name, image )
48 cvDestroyWindow(win_name)
52 cvDestroyWindow(win_name)
54 # create flag file for following tests
55 works.set_file(TESTNAME)