예제 #1
0
        public SpectrumDisplay(System.Drawing.Image input)
        {
            InitializeComponent();

            this.input       = new Bitmap(input);
            InputImage.Image = input;

            Cursor.Current = Cursors.WaitCursor;
            ToolStripStatusLabel.Visible = true;
            StatusBarProgressBar.Visible = true;
            SpectraWorker.RunWorkerAsync();
        }
예제 #2
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();
        }