mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-16 11:21:25 +08:00
expose lab/lch conversion
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user