python: How to fix this "ValueError"? : I loaded some images (with cv2.imread_color) into a list and i'm trying to get hsv (hue, saturnation, value) values from it with function "rgb_to_hsv".

I got red, green and blue values but when i'm trying to get hsv values i get ***an error about parameters***:

Traceback (most recent call last):
  File "C:\Users\Downloads\preprocessing\program.py", line 69, in <module>
    hue_images[i], saturnation_images[i], value_images[i] = rgb_to_hsv(hsv_red[i], hsv_green[i], hsv_blue[i])

File "C:\Users\Downloads\preprocessing\program.py", line 24, in rgb_to_hsv
    mx = max(r, g, b)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()


This is the code i'm using:



```python
hue_images = list(range(len(image)))
saturnation_images = list(range(len(image)))
value_images = list(range(len(image)))

hsv_red = list(range(len(image)))
hsv_green = list(range(len(image)))
hsv_blue = list(range(len(image)))

def rgb_to_hsv(r, g, b):
    r, g, b = r/255.0, g/255.0, b/255.0
    mx = max(r, g, b)
    mn = min(r, g, b)
    df = mx-mn
    if mx == mn:
        h = 0
    elif mx == r:
        h = (60 * ((g-b)/df) + 360) % 360
    elif mx == g:
        h = (60 * ((b-r)/df) + 120) % 360
    elif mx == b:
        h = (60 * ((r-g)/df) + 240) % 360
    if mx == 0:
        s = 0
    else:
        s = (df/mx)*100
    v = mx*100
    return h, s, v

def hsv_get_red(img):
    red = img.copy()
    red[:, :, 0] = 0
    red[:, :, 1] = 0

    return red[:, :, 2]

def hsv_get_green(img):
    green = img.copy()
    green[:, :, 0] = 0
    green[:, :, 2] = 0

    return green[:, :, 1]

def hsv_get_blue(img):
    blue = img.copy()
    blue[:, :, 2] = 0
    blue[:, :, 1] = 0

    return blue[:, :, 0]

for i in range(len(image)):
    hsv_red[i] = hsv_get_red(image[i])
    hsv_green[i] = hsv_get_green(image[i])
    hsv_blue[i] = hsv_get_blue(image[i])

for i in range(len(image)):
    hue_images[i], saturnation_images[i], value_images[i] = rgb_to_hsv(hsv_red[i], hsv_green[i], hsv_blue[i])
```

My question is: How can I use list values as parameters in the function (it works with int numbers) to get results (another list values)? 

Thanks