By Jochen Voss, on
Just in case this is useful for anybody: here is an implementation of the HSV to RGB colorspace conversion in Python:
from __future__ import division def hsv2rgb(h, s, v): hi = int(h//60 % 6) f = h/60 - h//60 p = v * (1-s) q = v * (1-f*s) t = v * (1-(1-f)*s) return [ (v,t,p), (q,v,p), (p,v,t), (p,q,v), (t,p,v), (v,p,q) ][hi]
Update. In the meantime I learned that the Python standard library has a built-in version of this function in the colorsys module.
This is an excerpt from Jochen's blog.
Newer entry: paper accepted
Older entry: Sampling Conditioned Hypoelliptic Diffusions
Copyright © 2009 Jochen Voss. All content on this website (including text, pictures, and any other original works), unless otherwise noted, is licensed under the CC BY-SA 4.0 license.