def GuassNoiseDemo(self, img, miu, theta, noiseNum):
sz = img.shape
noiseImg = self.GuassNoise(img, miu, theta, noiseNum)
gImg = img + noiseImg
#pdf = self.GuassianPDF(miu, theta)
# for i in xrange(0, noiseNum):
# x = np.random.random() * (sz[0] - 1)
# y = np.random.random() * (sz[1] - 1)
# noise = self.PDFMap(pdf, np.random.random())
# print noise
# noiseImg[x, y] = noiseImg[x, y] + noise
cv2.namedWindow("lena")
cv2.namedWindow("gauss noise")
cv2.namedWindow("dst")
cv2.imshow("lena", img)
cv2.imshow("gauss noise", np.uint8(noiseImg))
cv2.imshow("dst", np.uint8(gImg))
cv2.waitKey(0)
评论列表
文章目录