**两个系统的python版本:第3.10.5节
我试图在我的图像上使用二进制掩码,并制作一个新的二进制图像。让我想知道的是,当我在我的另一个系统上用同样的代码练习同样的事情时,输出生成了,但在另一个系统上,它将返回此错误,并且不会生成二进制映像。(然后我想在主图像上使用40以下的像素掩码)。
在这里,我试图采取像素值低于40。
im = imread('image')
mask = im<40
plt.figure()
imshow(mask)
plt.show()
错误
4 plt.figure()
----> 5 imshow(mask)
6 plt.show()
7
TypeError: numpy boolean subtract, the `-` operator, is not supported, use the bitwise_xor, the `^` operator, or the logical_xor function instead.
<Figure size 432x288 with 0 Axes>
- (如果需要,请相应地编辑查询。)*
1条答案
按热度按时间0sgqnhkj1#
您需要使用numpy ma masked_where方法: