Added function to convert RGB to HSV.
Added some rationale in comment for controversial calculation.