From c1b72ea638119a7755f678897d6a2b7d6859bb15 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 27 Sep 2011 21:11:30 +0200 Subject: [PATCH] use dtype.img_as_float in _convert for colorspaces. All conversions are done as matrix multiplications with floats, so this is the only way not to lose precision. --- scikits/image/color/colorconv.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scikits/image/color/colorconv.py b/scikits/image/color/colorconv.py index 6393eb05..b1d4b320 100644 --- a/scikits/image/color/colorconv.py +++ b/scikits/image/color/colorconv.py @@ -50,6 +50,7 @@ __docformat__ = "restructuredtext en" import numpy as np from scipy import linalg +from ..util import dtype def convert_colorspace(arr, fromspace, tospace): @@ -299,9 +300,10 @@ def _convert(matrix, arr): Returns ------- - out : ndarray + out : ndarray, dtype=float The converted array. """ + arr = dtype.img_as_float(arr) arr = _prepare_colorarray(arr) arr = np.swapaxes(arr, 0, 2) oldshape = arr.shape