Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道 'meanColor()' 打印 BGR 的值,但我怎样才能单独获取这些值?
例如:
img = "picture" colors = img.meanColor() print(colors)
我得到这样的东西(30,10,40)
(30,10,40)
假设我想要30。
如何将它分配给另一个变量?
请解释您的解决方案。
谢谢
这是一个元组,所以你可以这样:
blue = colors[0] green = colors[1] red = colors[2] #or b, g, r = colors