Kilian Koepsell wrote:
Hi Jeff, I hope it is ok to contact you directly with this bug report -- feel free to reply to the list if appropriate. I found your previous posting through a web search, <http://firstname.lastname@example.org/msg10637.html>and then tried to use your implementation in matplotlib svn.
Killian: That's fine, just please CC the mailing list.
I noticed that the svn version is different from the one in the posting above and it seems to have two bugs: * in the function rgb_to_hsv_arr, the line arr = arr/255. is missing and therefore the script doesn't normalize the input any more and it doesn't type-cast it to float any more if used with uint8 rgb input.
That function is to be called by LightSource.shade using normalized rgb floats (between 0 and 1). You don't need to call it directly - instead just use the LightSource class as show in shading_example.py.
This seems to cause wrong results. * the script in the current form returns NaNs when applied to white [255,255,255] or white [0,0,0] inputs. This can be solved by adding the following line just before the return statement: out[delta==0,0] = 0 Best regards, Kilian
Again, don't use that old script you found in the email archive, but follow the shading_example.py example. The rgb_to_hsv function is not really part of the public API.