Merge pull request #223 from jni/jni-concatenate-image-collection

ENH: Concatenate image collection.
This commit is contained in:
Stefan van der Walt
2012-07-20 16:02:04 -07:00
2 changed files with 83 additions and 1 deletions
+15
View File
@@ -23,9 +23,12 @@ if sys.version_info[0] > 2:
class TestImageCollection():
pattern = [os.path.join(data_dir, pic) for pic in ['camera.png',
'color.png']]
pattern_matched = [os.path.join(data_dir, pic) for pic in
['camera.png', 'moon.png']]
def setUp(self):
self.collection = ImageCollection(self.pattern)
self.collection_matched = ImageCollection(self.pattern_matched)
def test_len(self):
assert len(self.collection) == 2
@@ -59,6 +62,12 @@ class TestImageCollection():
ic = ImageCollection(load_pattern, load_func=load_fn)
assert_equal(ic[1], (2, 'two'))
def test_concatenate(self):
ar = self.collection_matched.concatenate()
assert_equal(ar.shape, (len(self.collection_matched),) +
self.collection[0].shape)
assert_raises(ValueError, self.collection.concatenate)
class TestMultiImage():
@@ -102,6 +111,12 @@ class TestMultiImage():
self.img.conserve_memory = val
assert_raises(AttributeError, set_mem, True)
@skipif(not PIL_available)
def test_concatenate(self):
ar = self.img.concatenate()
assert_equal(ar.shape, (len(self.img),) +
self.img[0].shape)
if __name__ == "__main__":
run_module_suite()