Christina
Christina

Reputation: 935

Extract noise vector after using imnoise

I have a vector in which I have added a Gaussian white noise (with zero mean and standard deviation 0.001). More particularly, I used the imnoise function in MATLAB as:

pixel_noisy = imnoise(original_pixel, 'Gaussian', 0, 0.001);

My question: is there a way to extract the noise vector that has been added to the original pixel? The noise vector has been added automatically after the use of imnoise. Although that, is it possible to know what was this noise vector?

Any help will be very appreciated!

Upvotes: 1

Views: 50

Answers (1)

m7913d
m7913d

Reputation: 11072

The following relation holds between the original and the noisy image:

pixel_noisy = original_pixel + noise

Therefore, the noise can be calculated using a subtraction:

noise = original_pixel - pixel_noisy

Validation

You can validate this method by checking if the noise is indeed a Gaussian distribution:

n = 100; % size of the image
original_pixel = rand(n, n); % constructs a random image
pixel_noisy = imnoise(original_pixel, 'Gaussian', 0, 0.001); % add noise
noise = pixel_noisy - original_pixel; % calculate the noise

mean = mean2(noise) % check the mean (should be 0)
variance = std2(noise)^2 % check the variance (should be 0.001)

For larger values of n, the mean and variance should match better their desired values.

Upvotes: 2

Related Questions