【发布时间】:2018-12-11 18:04:38
【问题描述】:
我正在尝试将高斯噪声添加到图像(“pepper.jpg”)。它有效,如结果所示(“noisy pepper.png”);但噪音并没有覆盖“辣椒”,而是在它周围。应用噪音时我缺少什么吗? 任何建议将不胜感激。
import cv2
import numpy as np
img = cv2.imread("pepper.jpg",0)
row, col = img.shape
mean = 0
var = 0.3
sigma = var ** 0.5
gauss = np.random.normal(mean, sigma, (row, col))
gauss = gauss.reshape(row, col)
noisyp = gauss + img
noisyp = noisyp.astype('uint8')
cv2.imwrite('noisy pepper.png', noisyp)
问候, 贝鲁兹
【问题讨论】:
标签: python computer-vision gaussian