Reputation: 47
Look my code, why the second line in console is 170 10 121
.
H
is 170
, S
is 10
, but why L
is 121
. Because L
must be less than 100
:
Upvotes: 2
Views: 12424
Reputation: 41765
As you can see in the OpenCV documentation
In case of 8-bit and 16-bit images, R, G, and B are converted to the floating-point format and scaled to fit the 0 to 1 range.
If
H<0
thenH=H+360
. On output0 <= L <= 1
,0 <= S <= 1
,0 <= H <= 360
.The values are then converted to the destination data type:
- 8-bit images: S,L are scaled in [0,255], H=H/2, so H range is in [0-180]
- 32-bit (float) images: value are left as is.
So, in the end, for CV_8U
images you'll have values in:
H in [0,180]
S,L in [0,255]
Upvotes: 13