【发布时间】:2015-03-22 07:32:06
【问题描述】:
我在 python 中将灰度图像加载为 numpy 数组。我想找到图像强度在指定范围内的坐标,比如[lowerlim,upperlim]。我尝试使用numpy.whereas 查找
np.where(image>lowerlim and image<upperlim)
但它给出了错误 - “具有多个元素的数组的真值不明确。”谁能指导我如何在 python 中做到这一点?
【问题讨论】:
-
您可能正在寻找
np.logical_and而不是常规的and -
感谢@cel ...解决了这个问题。我使用的命令: np.where(np.logical_and(image>lowerlim,image
标签: python image-processing numpy logical-operators