Global Bitmap Var



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AForge;
using AForge.Imaging;
using AForge.Imaging.Filters;
using AForge.Math;

namespace winForm1
{
    public partial class Form1 : Form
    {
        Bitmap image;       // Global Bitmap

        public Form1()
        {
            InitializeComponent();

            // load image
            image =
                AForge.Imaging.Image.FromFile(@"C:\Users\user\Pictures\rose.jpg");

        }

        // Calc FFT2 when button --------------------------------------------
        private void button1_Click(object sender, EventArgs e)
        {

            // create complex image
            ComplexImage complexImage = ComplexImage.FromBitmap(image);
            // do forward Fourier transformation
            complexImage.ForwardFourierTransform();
            // get complex image as bitmat
            Bitmap fourierImage = complexImage.ToBitmap();

            pictureBox1.Image = fourierImage;
            MessageBox.Show("Good~!");

        }

        // show Original Image --------------------------------------------
        private void Form1_Load(object sender, EventArgs e)
        {
            pictureBox2.Image = image;
           
        }

        // form exit ------------------------------------------------------
        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}

댓글

이 블로그의 인기 게시물

Draw Circle on PictureBox when Button Click - Winform

2D FFT of Gray Image by AForge