Search code examples
pythonsimplecv

meanColor() get BGR simpleCV


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


Solution

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

    blue  = colors[0]
    green = colors[1]
    red   = colors[2]  
    #or
    b, g, r = colors