Beispiel #1
0
        static public double[,] DoNormalization(this double[,] image, int bordMean, int bordVar)
        {
            var mean      = image.CalculateMean();
            var variation = image.CalculateVariation(mean);

            for (int i = 0; i < image.GetLength(0); i++)
            {
                for (int j = 0; j < image.GetLength(1); j++)
                {
                    if (image[i, j] > mean)
                    {
                        image[i, j] = bordMean + Math.Sqrt((bordVar * Math.Pow(image[i, j] - mean, 2)) / variation);
                    }
                    else
                    {
                        image[i, j] = bordMean - Math.Sqrt((bordVar * Math.Pow(image[i, j] - mean, 2)) / variation);
                    }
                }
            }

            return(image);
        }