2024-04-26 11:57:15 发布
网友
我使用的是Python的colorsys库:
import colorsys colorsys.rgb_to_hsv(64, 208, 61) output:(0.16666666666666666, 0, 208)
但是这个输出是错误的,这是使用RGB到HSV在线转换器的真实值: RGB to HSV
怎么回事?在
colorsys取值范围为0到1:
colorsys
0
1
Coordinates in all of these color spaces are floating point values. In the YIQ space, the Y coordinate is between 0 and 1, but the I and Q coordinates can be positive or negative. In all other spaces, the coordinates are all between 0 and 1.
您需要将每个值除以255.以获得预期输出:
255.
>>> colorsys.rgb_to_hsv(64/255., 208/255., 61/255.) (0.3299319727891157, 0.7067307692307692, 0.8156862745098039)
colorsys
取值范围为0
到1
:您需要将每个值除以
255.
以获得预期输出:相关问题 更多 >
编程相关推荐