如果 (x, x, x) 中的任何值低于 x

欧文昆兰

所以我的代码是这样的:如何检查 (x, x, x) 中的值是否低于 5

for i in range(img.size[0]):  # for every pixel:
    for j in range(img.size[1]):
        if pixels[i,j] != (0, 0, 0) and (1, 0, 0) and (0, 1, 0) and (0, 0, 1) and (1, 1, 0) and (0, 1, 1) and (1, 0, 1) and (1, 1, 1) and (1, 1, 2) and (1, 2, 1) and (2, 1, 1) and (2, 2, 1) and (1, 2, 2) and (2, 1, 2) and (2, 2 ,2):  # if not black:
            pixels[i,j] = (255, 255, 255)  # change to white
网波

只需通过迭代元组来检查您的组件:

...
if not any(value <= 5 for value in pixels[i,j]):
...

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章