ForwardFourierTransform() public method

Applies forward fast Fourier transformation to the complex image.
public ForwardFourierTransform ( ) : void
return void
Esempio n. 1
0
        private void SpectraWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            if (input.Width != input.Height)
            {
                throw new System.ApplicationException(
                          "The image height and width must be the same.");
            }

            SpectraWorker.ReportProgress(0, "Computing spectra");

            // The AForge FFT requires an 8 bits per pixel input format.
            Bitmap gray_8bpp
                = AForge.Imaging.Filters.Grayscale.CommonAlgorithms.Y.Apply(input);

            AForge.Imaging.ComplexImage fft
                = ComplexImage.FromBitmap(gray_8bpp);
            fft.ForwardFourierTransform();

            SpectraWorker.ReportProgress(100, "Fourier Spectra Calculated.");
            fourier = fft.ToBitmap();
        }
        private static Bitmap GetSalMap(Bitmap sr, double[,] phase)
        {
            AForge.Imaging.ComplexImage totalSpec = AForge.Imaging.ComplexImage.FromBitmap(sr);

            // exp(SR + 1i * Phase)
            for (int x = 0; x < IMAGE_SIZE_X; x++)
            {
                for (int y = 0; y < IMAGE_SIZE_Y; y++)
                {
                    totalSpec.Data[x, y].Im = phase[x, y];
                    totalSpec.Data[x, y]    = Complex.Exp(totalSpec.Data[x, y]);
                }
            }

            totalSpec.ForwardFourierTransform();

            // .^2
            for (int x = 0; x < IMAGE_SIZE_X; x++)
            {
                for (int y = 0; y < IMAGE_SIZE_Y; y++)
                {
                    totalSpec.Data[x, y] =
                        Complex.Multiply(totalSpec.Data[x, y], totalSpec.Data[x, y]);
                }
            }

            // shift
            Complex[,] shifted = Shift(totalSpec.Data, IMAGE_SIZE_X, IMAGE_SIZE_Y);
            for (int x = 0; x < IMAGE_SIZE_X; x++)
            {
                for (int y = 0; y < IMAGE_SIZE_Y; y++)
                {
                    totalSpec.Data[x, y] = shifted[x, y];
                }
            }

            return(totalSpec.ToBitmap());
        }
Esempio n. 3
0
 public Bitmap ImagenCompleja()
 {
     cimage = ComplexImage.FromBitmap(imagen);
     cimage.ForwardFourierTransform();
     imagen = cimage.ToBitmap();
     return imagen;
 }