S value range after cvtColor() conversion to HSV with float32

51 views Asked by At

I converted my numpy array from 8 to 32 bits, resulting Hue values will range in [0,360]. from OpenCV docs-Color conversions, for 32-bit images: H, S, and V are left as is, after conversion.

However the Value channel range is still in [0,255], and the Saturation range changes to [0,1] while the range was [0,255] with 8 bits array. Could anyone help me to understand why does the conversion to float32 change the range of the Saturation channel while no change for Value channel range?

import cv2 as cv
import numpy as np

greenRGB = np.uint8([[[0,255,0 ]]])
greenRGB = np.float32(greenRGB)

greenHSV = cv.cvtColor(greenRGB,cv.COLOR_RGB2HSV)
print(greenHSV, greenHSV.dtype)

returns:

[[[120.   1. 255.]]] float32
0

There are 0 answers