mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-10 13:37:01 +08:00
doc cleanup
This commit is contained in:
@@ -1044,21 +1044,18 @@ def lab2lch(lab):
|
||||
----------
|
||||
lab : array_like
|
||||
The N-D image in CIE-LAB format. The last (`N+1`th) dimension must have
|
||||
at least 3 elements, corresponding to the `L`, `a`, and `b` color
|
||||
at least 3 elements, corresponding to the ``L``, ``a``, and ``b`` color
|
||||
channels. Subsequent elements are copied.
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
The image in LCH format, in a 3-D array of shape (.., .., 3).
|
||||
The image in LCH format, in a N-D array with same shape as input `lab`.
|
||||
|
||||
Raises
|
||||
------
|
||||
ValueError
|
||||
If `rgb` is not a 3-D array of shape (.., .., 3).
|
||||
|
||||
References
|
||||
----------
|
||||
If `lch` does not have at least 3 color channels (i.e. l, a, b).
|
||||
|
||||
Notes
|
||||
-----
|
||||
@@ -1096,23 +1093,20 @@ def lch2lab(lch):
|
||||
|
||||
Parameters
|
||||
----------
|
||||
lab : array_like
|
||||
lch : array_like
|
||||
The N-D image in CIE-LCH format. The last (`N+1`th) dimension must have
|
||||
at least 3 elements, corresponding to the `L`, `a`, and `b` color
|
||||
at least 3 elements, corresponding to the ``L``, ``a``, and ``b`` color
|
||||
channels. Subsequent elements are copied.
|
||||
|
||||
Returns
|
||||
-------
|
||||
out : ndarray
|
||||
The image in LAB format, in a 3-D array of shape (.., .., 3).
|
||||
The image in LAB format, with same shape as input `lch`.
|
||||
|
||||
Raises
|
||||
------
|
||||
ValueError
|
||||
If `rgb` is not a 3-D array of shape (.., .., 3).
|
||||
|
||||
References
|
||||
----------
|
||||
If `lch` does not have at least 3 color channels (i.e. l, c, h).
|
||||
|
||||
Examples
|
||||
--------
|
||||
@@ -1138,5 +1132,6 @@ def _prepare_lab_array(arr):
|
||||
"""
|
||||
arr = np.asarray(arr)
|
||||
shape = arr.shape
|
||||
assert shape[-1] >= 3
|
||||
if shape[-1] < 3:
|
||||
raise ValueError('Input array has less than 3 color channels')
|
||||
return dtype.img_as_float(arr, force_copy=True)
|
||||
|
||||
+16
-15
@@ -56,7 +56,7 @@ def deltaE_ciede94(lab1, lab2, kH=1, kC=1, kL=1, k1=0.045, k2=0.015):
|
||||
"""Color difference according to CIEDE 94 standard
|
||||
|
||||
Accommodates perceptual non-uniformities through the use of application
|
||||
specific scale factors (kH, kC, kL, k1, and k2).
|
||||
specific scale factors (`kH`, `kC`, `kL`, `k1`, and `k2`).
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -87,14 +87,14 @@ def deltaE_ciede94(lab1, lab2, kH=1, kC=1, kL=1, k1=0.045, k2=0.015):
|
||||
color. Consequently, the first color should be regarded as the "reference"
|
||||
color.
|
||||
|
||||
kL, k1, k2 depend on the application and default to the values suggested
|
||||
for graphic arts
|
||||
`kL`, `k1`, `k2` depend on the application and default to the values
|
||||
suggested for graphic arts
|
||||
|
||||
Parameter Graphic Arts Textiles
|
||||
---------- ------------- --------
|
||||
kL 1.000 2.000
|
||||
k1 0.045 0.048
|
||||
k2 0.015 0.014
|
||||
`kL` 1.000 2.000
|
||||
`k1` 0.045 0.048
|
||||
`k2` 0.015 0.014
|
||||
|
||||
References
|
||||
----------
|
||||
@@ -131,7 +131,7 @@ def deltaE_ciede2000(lab1, lab2, kL=1, kC=1, kH=1):
|
||||
lab2 : array_like
|
||||
comparison color (Lab colorspace)
|
||||
kL : float (range), optional
|
||||
luminance scale factor, 1 for "acceptably close"; 2 for "imperceptible"
|
||||
lightness scale factor, 1 for "acceptably close"; 2 for "imperceptible"
|
||||
see deltaE_cmc
|
||||
kC : float (range), optional
|
||||
chroma scale factor, usually 1
|
||||
@@ -145,8 +145,8 @@ def deltaE_ciede2000(lab1, lab2, kL=1, kC=1, kH=1):
|
||||
|
||||
Notes
|
||||
-----
|
||||
CIEDE 2000 assumes parametric weighting factors for the luminance, chroma,
|
||||
and hue (kL, kC, kH respectively). These default to 1.
|
||||
CIEDE 2000 assumes parametric weighting factors for the lightness, chroma,
|
||||
and hue (`kL`, `kC`, `kH` respectively). These default to 1.
|
||||
|
||||
References
|
||||
----------
|
||||
@@ -187,7 +187,7 @@ def deltaE_ciede2000(lab1, lab2, kL=1, kC=1, kH=1):
|
||||
# 3) Chroma term
|
||||
# 4) hue Rotation term
|
||||
|
||||
# luminance term
|
||||
# lightness term
|
||||
Lbar = 0.5 * (L1 + L2)
|
||||
tmp = (Lbar - 50) ** 2
|
||||
SL = 1 + 0.015 * tmp / np.sqrt(20 + tmp)
|
||||
@@ -250,10 +250,11 @@ def deltaE_cmc(lab1, lab2, kL=1, kC=1):
|
||||
(CMC) of the Society of Dyers and Colourists (United Kingdom). It is
|
||||
intended for use in the textile industry.
|
||||
|
||||
The scale factors kL, kC set the weight given to differences in lightness
|
||||
and chroma relative to differences in hue. The usual values are kL=2, kC=1
|
||||
for "acceptability" and kL=1, kC=1 for "imperceptibility". Colors with
|
||||
dE > 1 are "different" for the given scale factors.
|
||||
The scale factors `kL`, `kC` set the weight given to differences in
|
||||
lightness and chroma relative to differences in hue. The usual values are
|
||||
``kL=2``, ``kC=1`` for "acceptability" and ``kL=1``, ``kC=1`` for
|
||||
"imperceptibility". Colors with ``dE > 1`` are "different" for the given
|
||||
scale factors.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -271,7 +272,7 @@ def deltaE_cmc(lab1, lab2, kL=1, kC=1):
|
||||
-----
|
||||
deltaE_cmc the defines the scales for the lightness, hue, and chroma
|
||||
in terms of the first color. Consequently
|
||||
deltaE_cmc(lab1, lab2) != deltaE_cmc(lab2, lab1)
|
||||
``deltaE_cmc(lab1, lab2) != deltaE_cmc(lab2, lab1)``
|
||||
|
||||
References
|
||||
----------
|
||||
|
||||
Reference in New Issue
Block a user