Emgucv中的高斯噪声 [英] Gaussian Noise in emgucv
问题描述
如何使用emgucv向图像中添加高斯噪声(具有特定的均值和方差)?
How can I add gaussian noise ( with a particular mean and variance ) to an image using emgucv ?
推荐答案
I'我不确定您作为高斯滤波器的要求是否倾向于消除噪声。要使用自定义内核,可以使用以下代码。如果您希望以设定的均值和方差添加噪声,则可能必须求助于遍历my_image.Data属性并以这种方式添加。这是使用自定义内核的代码,如果不是您所需要的,请告诉我,我将尝试找到更合适的方法,在这种情况下,指向示例图像的链接可能会有用。
I'm not sure quite what your asking as a Gaussian filter tends to be there to remove noise. To use a custom kernel you can use the following code. If you wish to add noise with a set mean and variance then you may have to resort to looping through the my_image.Data property and add it that way. Here is the code for using a custom Kernel if it's not quite what your after let me know and I'll try and find something more appropriate a link to example images may be useful in this case.
Image<Bgr, Byte> my_image = new Image<Bgr, byte>(open.FileName);
float[,] k = { {0, 0, 0},
{0, 0, -0},
{0.33F, 0, -0}};
ConvolutionKernelF kernel = new ConvolutionKernelF(k);
Image<Bgr, float> convolutedImage = my_image * kernel;
pictureBox1.Image = convolutedImage.ToBitmap();
我希望这会有所帮助,
Chris
这篇关于Emgucv中的高斯噪声的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!