I'm trying to add non-Gaussian noise to an image. The purpose is to synthesize realistic camera noise. I am doing the following:
Obtain a noisy image sample by subtracting a low ISO photo from a high ISO of the same photo.
Find a flat 128x128 section of image with no edges by randomly cropping and checking if the standard deviation is small enough.
Zero mean the patch.
Normalise the patch by the patch standard deviation.
Compute PSD (power spectral density) by windowing and then using fast Fourier transform (
fftnin Pytorch). Followed by squaring the frequency domain representation.
Generate Gaussian noise of same standard deviation as cropped noise patch.
Compute frequency representation and PSD of noise as above.
Do the following:
H = gaussian_noise_psd / image_psd output = image_frequency_domain * H
Lastly I convert back to spatial domain by reverse FFT and reversing the normalization step.
My output doesn't look quite right. The generated noise seems to be a pattern and doesn't look very natural. I'll put a sample below. I've added 0.5 to the output as the noise is zero mean.
Cropped area from noisy sample
Generated Gaussian noise of same std as above
Output of experiment
While the first two images have a std of 2 in this case, the output image has a much higher std of 7.5. You may need to open the images in full screen as they are quite small. How do I replicate the noise properly?