Files
scikit-image/scikits/image/io/tests/test_histograms.py
T
sccolbert a3737fa34c Added tests for colormixer and histograms. Moved tests up a directory level because
nosetests doesnt see tests in a directory beginning with an _ (_plugins/).
Moved fancy imshow to its own module scivi.py
2009-11-08 02:40:12 +01:00

29 lines
835 B
Python

from numpy.testing import *
import numpy as np
import scikits.image.io._plugins._colormixer as cm
from scikits.image.io._plugins._histograms import histograms
class TestHistogram:
def test_basic(self):
img = np.ones((50, 50, 3), dtype=np.uint8)
r, g, b, v = histograms(img, 255)
for band in (r, g, b, v):
yield assert_equal, band.sum(), 50*50
def test_counts(self):
channel = np.arange(255).reshape(51, 5)
img = np.empty((51, 5, 3), dtype='uint8')
img[:,:,0] = channel
img[:,:,1] = channel
img[:,:,2] = channel
r, g, b, v = histograms(img, 255)
assert_array_equal(r, g)
assert_array_equal(r, b)
assert_array_equal(r, v)
assert_array_equal(r, np.ones(255))
if __name__ == "__main__":
run_module_suite()