gpt4 book ai didi

python - python opencv中如何统计某个像素值的像素个数?

转载 作者:太空宇宙 更新时间:2023-11-03 21:21:35 28 4
gpt4 key购买 nike

我想计算图像中 value=[0,100,234] 的像素数。

在不对图像使用循环的情况下,您能否提出一种方法来确定这些特定像素的数量?

最佳答案

要计算值为 [0,100,234] 的像素数,您可以使用:

np.count_nonzero((img == [0, 100, 234]).all(axis = 2))

关于python - python opencv中如何统计某个像素值的像素个数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42255410/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com