def __init__(self, path): if not path.endswith(".jpg"): raise VisionCppException("Unspported image type") self.input = os.path.expanduser(path) if not os.path.exists(self.input): raise VisionCppException("Image file '{}' not found".format( self.input)) # TODO: Use opencv to get image properties. self.width, self.height = util.get_image_size(self.input) self.channels = 3
def test_get_image_size_unsupported_type(self): with self.assertRaises(vp.VisionCppException): util.get_image_size(data_path('lena.bmp'))
def test_get_image_size_gif(self): w, h = util.get_image_size(data_path('lena.gif')) self.assertEqual(512, w) self.assertEqual(512, h)