mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-04 01:41:39 +08:00
Add note on loss of precision.
This commit is contained in:
@@ -31,6 +31,15 @@ def rgb2hsv(rgb):
|
||||
ValueError
|
||||
If `rgb` is not a 3-D array of shape (.., .., 3).
|
||||
|
||||
Notes
|
||||
-----
|
||||
Conversion between RGB and HSV color spaces results in some loss of
|
||||
precision, due to integer arithmetic and rounding [1]_.
|
||||
|
||||
References
|
||||
----------
|
||||
.. [1] http://en.wikipedia.org/wiki/HSL_and_HSV
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> import os
|
||||
@@ -102,6 +111,15 @@ def hsv2rgb(hsv):
|
||||
ValueError
|
||||
If `hsv` is not a 3-D array of shape (.., .., 3).
|
||||
|
||||
Notes
|
||||
-----
|
||||
Conversion between RGB and HSV color spaces results in some loss of
|
||||
precision, due to integer arithmetic and rounding [1]_.
|
||||
|
||||
References
|
||||
----------
|
||||
.. [1] http://en.wikipedia.org/wiki/HSL_and_HSV
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> import os
|
||||
|
||||
@@ -54,7 +54,7 @@ class TestColorconv(TestCase):
|
||||
hsv = np.array([colorsys.rgb_to_hsv(pt[0], pt[1], pt[2])
|
||||
for pt in rgb.reshape(-1, 3)]).reshape(rgb.shape)
|
||||
# convert back to RGB and compare with original.
|
||||
# float32 -> relative precision about 1e-6
|
||||
# relative precision for RGB -> HSV roundtrip is about 1e-6
|
||||
assert_almost_equal(rgb, hsv2rgb(hsv), decimal=4)
|
||||
|
||||
def test_hsv2rgb_error_grayscale(self):
|
||||
|
||||
Reference in New Issue
Block a user