为什么均值滤波器给出全白输出?
Why is the mean filter giving totally white output?
Here in Accord.net,他们用了
1, 1, 1,
1, 1, 1,
1, 1, 1,
我也在用same here in my code。
public partial class Filters
{
private static double[,] _meanKernel =
new double[,] { { 1, 1, 1, },
{ 1, 1, 1, },
{ 1, 1, 1, }, };
public static Bitmap FftMean(Bitmap image)
{
return FftPaddedConvolutionFilter(image, _meanKernel);
}
}
但是,我得到的是全白输出。
我做错了什么?
如果你按原样使用这个内核,你会计算 8 邻域中所有像素的总和。所以我猜测对于大部分的像素,结果都是大于255,然后被截断了。
如果要计算平均值,请使用 1.0/9.0 而不是 1。
Here in Accord.net,他们用了
1, 1, 1,
1, 1, 1,
1, 1, 1,
我也在用same here in my code。
public partial class Filters
{
private static double[,] _meanKernel =
new double[,] { { 1, 1, 1, },
{ 1, 1, 1, },
{ 1, 1, 1, }, };
public static Bitmap FftMean(Bitmap image)
{
return FftPaddedConvolutionFilter(image, _meanKernel);
}
}
但是,我得到的是全白输出。
我做错了什么?
如果你按原样使用这个内核,你会计算 8 邻域中所有像素的总和。所以我猜测对于大部分的像素,结果都是大于255,然后被截断了。
如果要计算平均值,请使用 1.0/9.0 而不是 1。