向图像添加泊松噪声

向图像添加泊松噪声,第1张

向图像添加泊松噪声

如果您可以使用numpy /
scipy,则以下内容应会有所帮助。我建议您将数组转换为浮点数以进行中间计算,然后将其转换回uint8以进行输出/显示。由于泊松噪声都> =
0,因此您需要决定在转换回uint8时如何处理数组溢出。您可以根据自己的目标进行缩放或截断。

filename = 'myimage.png'imagea = (scipy.misc.imread(filename)).astype(float)poissonNoise = numpy.random.poisson(imagea).astype(float)noisyImage = imagea + poissonNoise#here care must be taken to re cast the result to uint8 if needed or scale to 0-1 etc...


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5664040.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存