问题描述
我的意思是
这是我的代码:
def display_img(img):
fig = plt.figure(figsize=(12,10))
ax = fig.add_subplot(111)
ax.imshow(img,cmap='gray')
1。)下面的代码按预期给出了黑色图像。
black = np.zeros((600,600),dtype=np.int8)
black
display_img(black)
array([[0,...,0],[0,0]],dtype=int8)
2。)下面的代码给出了具有白色噪声的混合图像黑色图像,因为现在有些值为1。
white_noise = np.random.randint(low=0,high=2,size=(600,600))
white_noise
display_img(white_noise)
array([[0,1,[1,1],0]])
3。)下面的代码给出黑色图像,但我希望看到白色
white = np.ones((600,dtype=np.int8)
white
white
array([[1,1]],dtype=int8)
display_img(white)