2024-04-25 08:46:03 发布
网友
我是新来的,遇到麻烦了。在
我有两个numpy阵列,img和thr:
>>>img.shape (2448, 3264, 3) >>>thr.shape (2448, 3264)
我想这样做:只在thr[x,y] is not 0时设置img[x,y] = [255,255,255]
thr[x,y] is not 0
img[x,y] = [255,255,255]
我试着在数组上迭代并自己做,但这需要很长时间,所以我真的需要numpy下面的C。我也看了屏蔽数组,但我不知道如何使用它们。在
谢谢!在
使用NumPy assignment to an indexed array:
img[thr != 0] = [255,255,255]
使用NumPy assignment to an indexed array:
相关问题 更多 >
编程相关推荐