[Scipy-svn] r2753 - trunk/Lib/sandbox/image

scipy-svn@scip... scipy-svn@scip...
Thu Feb 22 15:00:39 CST 2007


Author: rkern
Date: 2007-02-22 15:00:31 -0600 (Thu, 22 Feb 2007)
New Revision: 2753

Modified:
   trunk/Lib/sandbox/image/color.py
Log:
Correct L*u*v* transformation for scalars.

Modified: trunk/Lib/sandbox/image/color.py
===================================================================
--- trunk/Lib/sandbox/image/color.py	2007-02-22 20:50:12 UTC (rev 2752)
+++ trunk/Lib/sandbox/image/color.py	2007-02-22 21:00:31 UTC (rev 2753)
@@ -268,11 +268,10 @@
     """
     denominator = (x + 15*y + 3*z)
     zeros = (denominator == 0.0)
-    denominator[zeros] = 1.0
-    u_numerator = 4 * x
-    u_numerator[zeros] = 4.0
-    v_numerator = 9 * y
-    v_numerator[zeros] = 9.0 / 15.0
+    denominator = np.where(zeros, 1.0, denominator)
+    # I'm not entirely sure about these defaults when X=Y=Z=0.
+    u_numerator = np.where(zeros, 4.0, 4*x)
+    v_numerator = np.where(zeros, 9.0, 9 * y)
 
     return u_numerator/denominator, v_numerator/denominator
 



More information about the Scipy-svn mailing list