Ask Your Question

Revision history [back]

Adding Noise to Image - Opencv

Hi everyone!

I'm trying to to add noise to an Image & then Denoise it to test my DeNoising algorithm! So for benchmark i'm referring this Online Test samples. I'm trying to replicate the Noise model.

With reference to this threads 1 , 2 I'm adding noise to image like this!

Mat mSource_Bgr;
mSource_Bgr= imread(FileName_S,1);

double m_NoiseStdDev=10;

Mat mNoise_Bgr = mSource_Bgr.clone();
Mat mGaussian_noise = Mat(mSource_Bgr.size(),CV_8UC3);

randn(mGaussian_noise,0,m_NoiseStdDev);
mNoise_Bgr += mGaussian_noise;

normalize(mNoise_Bgr,mNoise_Bgr,0, 255, CV_MINMAX, CV_8UC3);

imshow("Output Window",mNoise_Bgr);
//imshow("Gaussian Noise",mGaussian_noise);

My Input Image

enter image description here

Output Image with Noise

enter image description here

Problem:

Adding Noise to the image alters overall brightness of the Image which in turn alters my final results PSNR!

I want to get the results as much as closer to this one! enter image description here

What i have tried so far!

I have tried to add the noise only in the color channel.

  1. Convert the Input image into YUV Color space
  2. Add the Noise only in the UV Color Channels & Keep the Y channel unaltered.

    Results are very bad & the overall color of the image is getting altered! Will add the code if needed!

So any advice regarding this is much appreciated! May be give me some formulas for adding Noise to the image!

Adding Noise to Image - Opencv

Hi everyone!

I'm trying to to add noise to an Image & then Denoise it to test my DeNoising algorithm! So for benchmark i'm referring this Online Test samples. I'm trying to replicate the Noise model.

With reference to this threads 1 , 2 I'm adding noise to image like this!

Mat mSource_Bgr;
mSource_Bgr= imread(FileName_S,1);

double m_NoiseStdDev=10;

Mat mNoise_Bgr = mSource_Bgr.clone();
Mat mGaussian_noise = Mat(mSource_Bgr.size(),CV_8UC3);

randn(mGaussian_noise,0,m_NoiseStdDev);
mNoise_Bgr += mGaussian_noise;

normalize(mNoise_Bgr,mNoise_Bgr,0, 255, CV_MINMAX, CV_8UC3);

imshow("Output Window",mNoise_Bgr);
//imshow("Gaussian Noise",mGaussian_noise);

My Input Image

enter image description here

Output Image with Noise

enter image description here

Problem:

Adding Noise to the image alters overall brightness of the Image which in turn alters my final results PSNR!

I want to get the results as much as closer to this one! enter image description here

What i have tried so far!

I have tried to add the noise only in the color channel.

  1. Convert the Input image into YUV Color space
  2. Add the Noise only in the UV Color Channels & Keep the Y channel unaltered.

    Results are very bad & the overall color of the image is getting altered! Will add the code if needed!

So any advice regarding this is much appreciated! May be give me some formulas for adding Noise to the image!

Adding Noise to Image - Opencv

Hi everyone!

I'm trying to to add noise to an Image & then Denoise it to test my DeNoising algorithm! So for benchmark i'm referring this Online Test samples. I'm trying to replicate the Noise model.

With reference to this threads 1 , 2 I'm adding noise to image like this!

Mat mSource_Bgr;
mSource_Bgr= imread(FileName_S,1);

double m_NoiseStdDev=10;

Mat mNoise_Bgr = mSource_Bgr.clone();
Mat mGaussian_noise = Mat(mSource_Bgr.size(),CV_8UC3);

randn(mGaussian_noise,0,m_NoiseStdDev);
mNoise_Bgr += mGaussian_noise;

normalize(mNoise_Bgr,mNoise_Bgr,0, 255, CV_MINMAX, CV_8UC3);

imshow("Output Window",mNoise_Bgr);
//imshow("Gaussian Noise",mGaussian_noise);

My Input Image

enter image description here

Output Image with Noise

enter image description here

Problem:

Adding Noise to the image alters overall brightness of the Image which in turn alters my final results PSNR!

I want to get the results as much as closer to this one! enter image description here

What i have tried so far!

I have tried to add the noise only in the color channel.

  1. Convert the Input image into YUV Color space
  2. Add the Noise only in the UV Color Channels & Keep the Y channel unaltered.

    Results are very bad & the overall color of the image is getting altered! Will add the code if needed!

So any advice regarding this is much appreciated! May be give me some formulas for adding Noise to the image!