expose lab/lch conversion

This commit is contained in:
Matt Terry
2013-07-23 21:32:37 -07:00
parent f67a088cce
commit 86f7c4a1d5
2 changed files with 12 additions and 0 deletions
+4
View File
@@ -15,6 +15,8 @@ from .colorconv import (convert_colorspace,
rgb2lab,
rgb2hed,
hed2rgb,
lab2lch,
lch2lab,
separate_stains,
combine_stains,
rgb_from_hed,
@@ -68,6 +70,8 @@ __all__ = ['convert_colorspace',
'rgb2lab',
'rgb2hed',
'hed2rgb',
'lab2lch',
'lch2lab',
'separate_stains',
'combine_stains',
'rgb_from_hed',
+8
View File
@@ -34,6 +34,7 @@ from skimage.color import (rgb2hsv, hsv2rgb,
xyz2lab, lab2xyz,
lab2rgb, rgb2lab,
is_rgb, is_gray,
lab2lch, lch2lab,
guess_spatial_dimensions
)
@@ -249,6 +250,13 @@ class TestColorconv(TestCase):
img_rgb = img_as_float(self.img_rgb)
assert_array_almost_equal(lab2rgb(rgb2lab(img_rgb)), img_rgb)
def test_lab_lch_roundtrip(self):
rgb = img_as_float(self.img_rgb)
lab = rgb2lab(rgb)
lab2 = lch2lab(lab2lch(lab))
assert_array_almost_equal(lab2, lab)
def test_gray2rgb():
x = np.array([0, 0.5, 1])
assert_raises(ValueError, gray2rgb, x)