Python中通过threshold创建mask

时间:2023-03-08 21:10:32

【code】

import numpy as np

threshold=2
a=np.array([[1,2,3],[3,4,5]])
b=a>threshold print("a="+str(a))
print("b="+str(b))

  

【result】

a=[[1 2 3]
[3 4 5]]
b=[[False False True]
[ True True True]]

  

相关文章