Question

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

Was it helpful?

Solution

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

blue  = colors[0]
green = colors[1]
red   = colors[2]  
#or
b, g, r = colors
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top