Пример #1
0
		// Private members
		#region Private Members

		// Create Gaussian filter
		private void CreateFilter()
		{
			// create Gaussian function
			AForge.Math.Gaussian gaus = new AForge.Math.Gaussian(sigma);
			// create kernel
			int[,] kernel = gaus.KernelDiscret2D(size);
			// create filter
			filter = new Correlation(kernel);
		}
Пример #2
0
        // Private members
        #region Private Members

        // Create Gaussian filter
        private void CreateFilter()
        {
            // create Gaussian function
            AForge.Math.Gaussian gaus = new AForge.Math.Gaussian(sigma);
            // create kernel
            int[,] kernel = gaus.KernelDiscret2D(size);
            // create filter
            filter = new Correlation(kernel);
        }
Пример #3
0
        // Private members
        #region Private Members

        // Create Gaussian filter
        private void CreateFilter()
        {
            // create Gaussian function
            AForge.Math.Gaussian gaus = new AForge.Math.Gaussian(sigma);

            // create Gaussian kernel
            int[,] kernel = gaus.KernelDiscret2D(size);

            // calculte sum of the kernel
            int sum = 0;

            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    sum += kernel[i, j];
                }
            }

            // recalc kernel
            int c = size >> 1;

            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    if ((i == c) && (j == c))
                    {
                        // calculate central value
                        kernel[i, j] = 2 * sum - kernel[i, j];
                    }
                    else
                    {
                        // invert value
                        kernel[i, j] = -kernel[i, j];
                    }
                }
            }

            // create filter
            filter = new Correlation(kernel);
        }
Пример #4
0
        // Create Gaussian filter
        private void CreateFilter()
        {
            // create Gaussian function
            AForge.Math.Gaussian gaus = new AForge.Math.Gaussian(sigma);

            // create Gaussian kernel
            int[,] kernel = gaus.KernelDiscret2D(size);

            // calculte sum of the kernel
            int sum = 0;

            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    sum += kernel[i, j];
                }
            }

            // recalc kernel
            int c = size >> 1;

            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    if ((i == c) && (j == c))
                    {
                        // calculate central value
                        kernel[i, j] = 2 * sum - kernel[i, j];
                    }
                    else
                    {
                        // invert value
                        kernel[i, j] = -kernel[i, j];
                    }
                }
            }

            // create filter
            filter = new Correlation(kernel);
        }