我正在尝试将图像从numpy数组格式转换为PIL格式 . 这是我的代码:
img = numpy.array(image)
row,col,ch= np.array(img).shape
mean = 0
# var = 0.1
# sigma = var**0.5
gauss = np.random.normal(mean,1,(row,col,ch))
gauss = gauss.reshape(row,col,ch)
noisy = img + gauss
im = Image.fromarray(noisy)
此方法的输入是PIL图像 . 此方法应将高斯噪声添加到图像并再次将其作为PIL图像返回 .
任何帮助是极大的赞赏!
1 回答
在我的评论中,我的意思是你做这样的事情: