tags:

views:

124

answers:

3

I'm looking for an efficient C or C++ algorithm that can convert RGB to HSV and vice versa. Thanks

+5  A: 

This link has the conversion algorithm, as well as example code in C++

http://en.literateprograms.org/RGB_to_HSV_color_space_conversion_%28C%29

Neil N
What about HSV to RGB?
Milo
HSV to RGB should be the same algorithm, in reverse ;)
Neil N
+1  A: 

I implemented it using formulas from wikipedia http://en.wikipedia.org/wiki/HSL_and_HSV

lmmilewski
+1  A: 

This link has formulas for what you want. Then it's a matter of performance (numerical techniques) if you want it fast.

John at CashCommons