这是因为在IPP图像库中做了一些尺度变换。比如:
S'=s*MAX_VAL.
H'=s*MAX_VAL/360.
Max_Val in 8bit unsigned is 255.
结果RGB 3x8bit to HSV 变换后仍保存为HSV 3x8bit 0-255.
有些软件用直接用16位的整数表示H,浮点数表示S, 不过有些软件也会像IPP一样做尺度调整。
RGB to HSV 基本变换公式是一样的 (从ipp manual中拷贝的)
// Value:
V = max(R,G,B);
// Saturation:
temp = min(R,G,B);
if V = 0 then // achromatics case
S = 0// H = 0
else // chromatics case
S = (V - temp)/V
// Hue:
Cr = (V - R) / (V - temp)
Cg = (V - G) / (V - temp)
Cb = (V - B) / (V - temp)
if R = V then H = Cb - Cg
if G = V then H = 2 + Cr - Cb
if B = V then H = 4 + Cg - Cr
H = 60*H
if H < 0 then H = H + 360。
The computed H,S,V values are scaled to the full range of the destination data type (see Table
2-2 in Chapter 2).