Changes in facedetect test

This commit is contained in:
Vladislav Sovrasov
2016-02-05 18:46:43 +03:00
parent 87fc75c6d7
commit 0c6e09f060
4 changed files with 17 additions and 8 deletions

View File

@@ -19,6 +19,7 @@ class NewOpenCVTests(unittest.TestCase):
# path to local repository folder containing 'samples' folder
repoPath = None
extraTestDataPath = None
# github repository url
repoUrl = 'https://raw.github.com/Itseez/opencv/master'
@@ -30,6 +31,11 @@ class NewOpenCVTests(unittest.TestCase):
if os.path.isfile(candidate):
with open(candidate, 'rb') as f:
filedata = f.read()
if NewOpenCVTests.extraTestDataPath is not None:
candidate = NewOpenCVTests.extraTestDataPath + '/' + filename
if os.path.isfile(candidate):
with open(candidate, 'rb') as f:
filedata = f.read()
if filedata is None:
filedata = urlopen(NewOpenCVTests.repoUrl + '/' + filename).read()
self.image_cache[filename] = cv2.imdecode(np.fromstring(filedata, dtype=np.uint8), iscolor)