且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何只打印一次值,而不是每个值?

更新时间:2021-11-20 22:45:06

您可以使用以下代码获取唯一像素的分布:

You can get the distribution of unique pixels using the following code:

from collections import Counter
Counter(pix_val)

如果您只需要知道哪些是独特的颜色,只需像 Adrian 在评论中告诉您的那样运行以下代码即可.

If you only need to know which are the unique colours, just run the following code as Adrian told you on the comments.

set(pix_val)