def rgb2lch(rgb):
"""Convert RBG to LCH colorspace (via LAB)
Input and output are in (bands, cols, rows) order
"""
# reshape for skimage (bands, cols, rows) -> (cols, rows, bands)
srgb = np.swapaxes(rgb, 0, 2)
# convert colorspace
lch = lab2lch(rgb2lab(srgb))
# return in (bands, cols, rows) order
return np.swapaxes(lch, 2, 0)
评论列表
文章目录