本文整理汇总了Python中skimage.color.lab2lch函数的典型用法代码示例。如果您正苦于以下问题:Python lab2lch函数的具体用法?Python lab2lch怎么用?Python lab2lch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lab2lch函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_rgb_lch_roundtrip
def test_rgb_lch_roundtrip(self):
rgb = img_as_float(self.img_rgb)
lab = rgb2lab(rgb)
lch = lab2lch(lab)
lab2 = lch2lab(lch)
rgb2 = lab2rgb(lab2)
assert_array_almost_equal(rgb, rgb2)
开发者ID:AceHao,项目名称:scikit-image,代码行数:7,代码来源:test_colorconv.py
示例2: rgb2lch
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)
开发者ID:ColinTalbert,项目名称:rasterio,代码行数:10,代码来源:saturation.py
示例3: test_lab_lch_3d
def test_lab_lch_3d(self):
lab0 = self._get_lab0()
lch0 = lab2lch(lab0)
lch3 = lab2lch(lab0[None, None, None, :])
assert_array_almost_equal(lch0, lch3[0, 0, 0, :])
开发者ID:AceHao,项目名称:scikit-image,代码行数:5,代码来源:test_colorconv.py
示例4: test_lab_lch_roundtrip
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)
开发者ID:AceHao,项目名称:scikit-image,代码行数:5,代码来源:test_colorconv.py
示例5: G
if img.dtype != 'float32':
img = cv2.normalize(img.astype('float32'), None, 0.0, 1.0, cv2.NORM_MINMAX)
# get dimensions of input image
x, y, z = img.shape
# store a copy of original image for comparison
img1 = np.zeros((x, y, z))
img1 = img.copy()
alpha = None
# Convert to colorspaces CIELAB, CIELUV, and CIELCH
lab = color.rgb2lab(img) # - RGB to LAB
luv = color.rgb2luv(img) # - RGB to LUV
LCH = color.lab2lch(img) # - LAB to LCH
# Compute G(x, y) for image
Gx = np.zeros((x, y)) # Create empty array for Gx component
Gy = np.zeros((x, y)) # Create empty array for Gy component
for i in range(1, x-1):
for j in range(1, y-1):
#Calculate the Gx and Gy per pixel using color difference from Eq 3 (on pg 2 of paper)
Gx[i, j] = color_difference(lab[i + 1, j, :], lab[i - 1, j, :], luv[i + 1, j, :], luv[i - 1, j, :], alpha)
Gy[i, j] = color_difference(lab[i, j + 1, :], lab[i, j - 1, :], luv[i, j + 1, :], luv[i, j - 1, :], alpha)
# Assign Lightness, chroma, and hue arrays from LCH to their own respective arrays
L = LCH[:, :, 0]
C = LCH[:, :, 1]
H = LCH[:, :, 2]
T = np.zeros((x, y, 9))
开发者ID:huis-clos,项目名称:color2gray,代码行数:31,代码来源:main.py
注:本文中的skimage.color.lab2lch函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论