I am trying to calculate the autocorrelation function of an image noise. Specifically, I want to calculate the NCORR parameter in the function deconvwnr(). I have knowledge about the noise, which is gaussian with mean 0 and variance 1. I found the examples in this website calculate the NCORR as follows:

NP = abs(fftn(noise)).^2;
NPOW = sum(NP(:))/prod(size(noise)); % noise power
NCORR = fftshift(real(ifftn(NP))); % noise ACF, centered

I tried following this method, but to do that, I first need to create an image of certain size and then add the gaussian noise into it. But the problem is that if I initialize the pixel values to be all 0, then after the application of gaussian noise, the image elements will only have intensity values above 0, which does not reflect the shape of the gaussian noise. On the other hand, if I initialize the pixel values to be all 1, then the image elements will only have intensity values below 1, which also does not reflect the shape of gaussian. Another way is to initialize the values to be 0.5, but then I was afraid that 0.5 will affect the NCORR values because it increases the noise power. Can someone show me how to do this or is there another way to calculate the autocorrelation function?

I = zeros([m, n]);
I = imnoise(I, 'gaussian', 0, 1);
# then follow the steps above

1 Answer 1


If you only care about the image noise you can get negative values. Besides, I don't understand why you want to stay between 0 and 1, white noise with STD of 1 cannot exist in this range.

  • $\begingroup$ How can I get negative values? I don't think that's possible because the function that i used to add the noise is imnoise(). For an image, you can not really have negative values, right? $\endgroup$ Commented Feb 21, 2017 at 12:26
  • 1
    $\begingroup$ I don't have the image processing toolbox anymore so it's hard for me to check but there are 2 things you can try: 1.Use the randn([image size])*std + mean to generate float gaussian noise 2. Just check the values you are getting with imnoise, you can look at the minimum and see if it goes below 0 $\endgroup$
    – Cherny
    Commented Feb 22, 2017 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.