logo

Crowdly

Soit le code suivant provenant de ColorSys , une librairie Core de CPython. ...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

Soit le code suivant provenant de ColorSys, une librairie Core de CPython.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

# HSV: Hue, Saturation, Value

# H: position in the spectrum

# S: color saturation ("purity")

# V: color brightness

def rgb_to_hsv

(r, g, b):

maxc

= max

(r, g, b)

minc

= min

(r, g, b)

rangec

= (maxc-

minc)

v

=

maxc

if minc ==

maxc:

return 0.0, 0.0

, v

s

= rangec /

maxc

rc

= (maxc-r) /

rangec

gc

= (maxc-g) /

rangec

bc

= (maxc-b) /

rangec

if r ==

maxc:

h

= bc-

gc

elif g ==

maxc:

h

= 2.0+rc-

bc

else

:

h

= 4.0+gc-

rc

h

= (h/6.0) % 1.0

return

h, s, v

Déterminer un oracle métamorphique pour cette fonction. 

HSV est un système de couleur qui exprime la plage de couleur différemment de RGB.

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.polymtl.ca?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!