mirror of https://github.com/opencv/opencv.git
Open Source Computer Vision Library
https://opencv.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
""" |
|
This script will test highgui's cvQueryFrame() function |
|
for different video formats |
|
""" |
|
|
|
# import the necessary things for OpenCV and comparson routine |
|
import os |
|
from highgui import * |
|
from cv import * |
|
import match |
|
|
|
# path to videos and images we need |
|
PREFIX=os.path.join(os.environ["srcdir"],"../../opencv_extra/testdata/python/") |
|
|
|
# this is the folder with the videos and images |
|
# and name of output window |
|
IMAGES = PREFIX+"images/" |
|
VIDEOS = PREFIX+"videos/" |
|
|
|
# testing routine, called for each entry in FILENAMES |
|
# and compares each frame with corresponding frame in COMPARISON |
|
def query_ok(FILENAME,ERRORS): |
|
|
|
# create a video reader using the tiny videofile VIDEOS+FILENAME |
|
video=cvCreateFileCapture(VIDEOS+FILENAME) |
|
|
|
if video is None: |
|
# couldn't open video (FAIL) |
|
return 1 |
|
|
|
# call cvQueryFrame for 29 frames and check if the returned image is ok |
|
for k in range(29): |
|
image=cvQueryFrame(video) |
|
|
|
if image is None: |
|
# returned image is NULL (FAIL) |
|
return 1 |
|
|
|
if not match.match(image,k,ERRORS[k]): |
|
return 1 |
|
|
|
cvReleaseCapture(video) |
|
# everything is fine (PASS) |
|
return 0
|
|
|