Why is the core always green?
Just because the function that performs the conversion of the integer kernel ImageDataConverter.ToBitmap32bitColorcalled from HomoMorphicKernel.GetKernelBitmapexplicitly assigns only the green and alpha components of the word RGBA:
for (int i = 0; i < bitmapData.Height; i++)
{
for (int j = 0; j < bitmapData.Width; j++)
{
address[0] = 0;
address[1] = (byte)image[j, i];
address[2] = 0;
address[3] = 255;
address += 4;
}
address += (bitmapData.Stride - (bitmapData.Width * 4));
}
, 8- , :
address[0] = (byte)image[j, i];
address[1] = (byte)image[j, i];
address[2] = (byte)image[j, i];
address[3] = 255;
, . . , , ?
. , Gaussian.GaussianKernelHPF . , , 1-f(x), f(x) - , . . ( FFT, Width*Height ), - :
double K = 1 / D1;
double S = Width * Height / (Math.PI * Math.PI * D2 * D2);
for (int i = -halfOfWidth; i < halfOfWidth; i++)
{
for (int j = -halfOfHeight; j < halfOfHeight; j++)
{
int x = halfOfWidth + i;
int y = halfOfHeight + j;
if (i == 0 && j == 0)
{
GaussianKernel[x, y] = Width * Height + (K / D1 - Kernel[x, y]) * S;
}
else
{
GaussianKernel[x, y] = -Kernel[x, y] * S;
}
}
}
, , (0,0), :
double[,] shifted = new double[Width, Height];
for (int j = 0; j < halfOfHeight; j++)
{
for (int i = 0; i < halfOfWidth; i++)
{
int x = i + halfOfWidth;
int y = j + halfOfHeight;
shifted[x, y] = GaussianKernel[i, j];
shifted[i, j] = GaussianKernel[x, y];
shifted[x, j] = GaussianKernel[i, y];
shifted[i, y] = GaussianKernel[x, j];
}
}
return shifted;
pull-request , (, Sigma 4, , ..) , .
- :

( , ) .
. , ( , ). , , , :
