Вопрос

I know that 'meanColor()' prints the values of BGR, but how can I individually get those values?

For example:

img = "picture"

colors = img.meanColor()

print(colors)

And I get something like this (30,10,40)

Let say I want the 30.

How can I assign it on another variable?

Please explain your solution.

Thanks

Это было полезно?

Решение

It's a tuple, so you can go like :

blue  = colors[0]
green = colors[1]
red   = colors[2]  
#or
b, g, r = colors
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top