mirror of
https://github.com/opencv/opencv.git
synced 2025-06-29 16:11:00 +08:00
test2.py: fail if a downloaded image can't be decoded
(cherry picked from commit 56f17e4921
)
This commit is contained in:
parent
e6f3f3c029
commit
7d28541bbe
@ -22,7 +22,9 @@ class NewOpenCVTests(unittest.TestCase):
|
||||
def get_sample(self, filename, iscolor = cv.CV_LOAD_IMAGE_COLOR):
|
||||
if not filename in self.image_cache:
|
||||
filedata = urllib.urlopen("https://raw.github.com/Itseez/opencv/2.4/" + filename).read()
|
||||
self.image_cache[filename] = cv2.imdecode(np.fromstring(filedata, dtype=np.uint8), iscolor)
|
||||
image = cv2.imdecode(np.fromstring(filedata, dtype=np.uint8), iscolor)
|
||||
self.assertFalse(image is None)
|
||||
self.image_cache[filename] = image
|
||||
return self.image_cache[filename]
|
||||
|
||||
def setUp(self):
|
||||
|
Loading…
Reference in New Issue
Block a user