Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

colors.rgb_to_hsv does not work properly with array of int dtype #1984

Merged
merged 1 commit into from

3 participants

@dlax

This is because out is defined as np.zeros_like(arr). Perhaps, float dtype should be enforced since the result is likely to be float.

@mdboom
Owner

@dlax: Does the attached patch fix your issue?

@dlax
@pelson pelson merged commit 4fd36da into from
@mdboom mdboom deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 7, 2013
  1. @mdboom
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/matplotlib/colors.py
View
2  lib/matplotlib/colors.py
@@ -1221,7 +1221,7 @@ def rgb_to_hsv(arr):
convert rgb values in a numpy array to hsv values
input and output arrays should have shape (M,N,3)
"""
- out = np.zeros_like(arr)
+ out = np.zeros(arr.shape, dtype=np.float)
arr_max = arr.max(-1)
ipos = arr_max > 0
delta = arr.ptp(-1)
Something went wrong with that request. Please try again.