0

I'm studying Image Processing and i need to make gaussian noise in c# with emgu cv. i find the code

Mat gaussian_noise = img.clone();

randn(gaussian_noise,128,30);

is make gaussian noise in open cv. what is the traslate code in emgu cv?

Community
  • 1
  • 1

1 Answers1

0

After searching a bit, I found out that the equivalent to randn on Emgu is the SetRandNormal(MCvScalar, MCvScalar) method on Matrix. So, to make something similar to your code, you'll have to do:

//Create your image as Image<Bgr,byte> here, for example.
Matrix<byte> matrix = new Matrix<byte>(img.Width, img.Height);
CvInvoke.cvConvert(img, matrix);
matrix.SetRandNormal(new MCvScalar(128), new MCvScalar(30));
//And Here you can convert back to image and do whatever you want.

That should work, but I don't have Emgu installed on this machine, so I can't test it right now.

Good luck!

Diogo Muller
  • 139
  • 1
  • 8