Exemplo n.º 1
0
        // load button
        private void loadPic_Click(object sender, EventArgs e)
        {
            string file_path = null;

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.InitialDirectory = @"C:\Users\A\Desktop\Image";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                file_path = ofd.FileName;   // 선택된 파일의 풀 경로를 저장.
                Toggle_stop();
                compare_stop();
            }
            else
            {
                return;
            }

            Mat selected_pic;

            selected_pic = Cv2.ImRead(@file_path);

            Bitmap pic_bitmap = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(selected_pic);

            pictureBox.BackgroundImageLayout = ImageLayout.Stretch;
            pictureBox.BackgroundImage       = pic_bitmap;
            state = Picbox_state.ORIGINAL;

            data.Set_Orgpic(pic_bitmap);
            data.Set_Aplpic(null);

            output.Show(); origin.Show();

            th_data.Initialize();
        }
Exemplo n.º 2
0
        // origin button
        private void origin_Click(object sender, EventArgs e)
        {
            Toggle_stop();
            compare_stop();

            pictureBox.BackgroundImage = data.Get_Orgpic();
            state = Picbox_state.ORIGINAL;
        }
Exemplo n.º 3
0
 // initPic button
 private void init_Click(object sender, EventArgs e)
 {
     data.Set_Orgpic(null); data.Set_Aplpic(null);
     pictureBox.BackgroundImage = null;
     state = Picbox_state.NONE;
     Empty_wishList();
     output.Hide(); origin.Hide();
     toggle.Checked  = false;
     compare.Checked = false;
     th_data.Initialize();
 }
Exemplo n.º 4
0
 private void Toggling()
 {
     while (toggle.Checked == true)
     {
         if (state == Picbox_state.ORIGINAL)
         {
             pictureBox.BackgroundImage = data.Get_Aplpic();
             state = Picbox_state.OUTPUT;
         }
         else
         {
             pictureBox.BackgroundImage = data.Get_Orgpic();
             state = Picbox_state.ORIGINAL;
         }
         Thread.Sleep(1000);
     }
 }
Exemplo n.º 5
0
        // output button
        private void output_Click(object sender, EventArgs e)
        {
            if (IsAplDataNull() != true)
            {
                Toggle_stop();
                compare_stop();

                if (toggle.Checked == false)
                {
                    if (toggle_thread != null)
                    {
                        toggle_thread.Join();
                    }
                }
                pictureBox.BackgroundImage = data.Get_Aplpic();
                state = Picbox_state.OUTPUT;
            }
            else
            {
                toggle.Checked = false;
            }
        }
Exemplo n.º 6
0
        // apply button
        private void apply_Click(object sender, EventArgs e)
        {
            if (data.IsOrgpicNull() == true)
            {
                return;
            }
            if (data.Get_List()?.Any() != true)
            {
                MessageBox.Show("   필터 목록이 비어있습니다.   \n   필터를 선택해주세요.   ");
            }
            Bitmap pic = filter.Applied_Filters(data);

            if (compare.Checked == true)
            {
                pictureBox.BackgroundImage = line.Redrawing(data.Get_Orgpic(), pic);
            }
            else
            {
                pictureBox.BackgroundImage = pic;
            }
            state = Picbox_state.OUTPUT;
            data.Set_Aplpic(pic);
        }