我正在尝试将高斯噪声添加到灰度图像,然后显示其直方图。它显示高斯曲线,但有 0 和 255 灰度值的高度。不应该是纯高斯曲线吗?
这是我的代码
clc
clear all
I = imread('lena.tiff');
I = rgb2gray(I);
N = imnoise(I,'gaussian',0,0.025);
figure; [counts,x] = imhist(N);
stem(x,counts);
最佳答案
如 Matlab 手册中所述 (http://nl.mathworks.com/help/images/ref/imnoise.html?searchHighlight=imnoise)
Note The mean and variance parameters for 'gaussian', 'localvar', and 'speckle' noise types are always specified as if the image were of class double in the range [0, 1]. If the input image is of class uint8 or uint16, the imnoise function converts the image to double, adds noise according to the specified type and parameters, and then converts the noisy image back to the same class as the input.
关于matlab - 为什么Matlab Gaussian Noise会增加0和255的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27403689/