Exemple #1
0
        private void MS_File_Open_Click(object sender, System.EventArgs e)
        {
            OFD.FileName     = "";
            SS_LBStatus.Text = "圖片開啟中";
            if (OFD.ShowDialog() == DialogResult.OK)
            {
                StopProcess();

                this.Cursor = Cursors.WaitCursor;

                string filepath = OFD.FileName;

                OImg   = new Bitmap(filepath);
                RImg   = new Bitmap(filepath);
                OrQImg = GrayImg.From(filepath);
                OrSImg = BGRImg.From(filepath);

                PB_Result.Image  = OrQImg.ToImage();
                PB_Result.Height = FLP_Result.Height;
                PB_Result.Width  = OrQImg.Width * FLP_Result.Height / OrQImg.Height;

                QImg = OrQImg.Extend();
                SImg = OrSImg.Extend();

                K = new SimpleMotionKernel(QImg.Width, QImg.Height, 53);

                QImg.FFT2();
                SImg.FFT2();

                QThread = new Thread(QProcess);
                QThread.Start();

                this.Cursor = Cursors.Default;
            }
        }
Exemple #2
0
        private void SProcess()
        {
            SS_PB.Value = 0;
            int length = TrB_Length.Value;

            SS_PB.Value = 10;
            int lambda = TrB_Lambda.Value;

            SS_PB.Value = 15;
            BGRImg ReSImg = SImg.InsideSimpleMotionDeblur(K, lambda);

            SS_PB.Value = 70;
            ReSImg.BFFTShift();
            SS_PB.Value = 80;
            ReSImg.IFFT2();
            SS_PB.Value = 90;
            ReSImg      = ReSImg.UnExtend(OrQImg.Width, OrQImg.Height);
            if (PB_Result.Image != null)
            {
                PB_Result.Image.Dispose();
                PB_Result.Image = null;
            }
            if (RImg != null)
            {
                RImg.Dispose();
                RImg = null;
            }
            RImg             = ReSImg.ToImage();
            PB_Result.Image  = RImg;
            SS_LBStatus.Text = "完整圖片";
            SS_PB.Value      = 100;
            SS_PB.Visible    = false;
            XProcessing      = false;
            GC.Collect();
        }
 static void Main(string[] args)
 {
     try {
         if (args.Length >= 4)
         {
             float  Length = Convert.ToSingle(args[3]);
             BGRImg Source = BGRImg.From(args[0]);
             Source.SimpleMotionBlur(Length).ToImage().Save(args[1], ImgF.ChooseImgFormat(args[2]));
             Environment.Exit(0);
         }
         else
         {
             Environment.Exit(1);
         }
     } catch (Exception ex) {
         Console.WriteLine(ex.ToString());
         Environment.Exit(2);
     }
 }
 static void Main(string[] args)
 {
     try {
         if (args.Length >= 3)
         {
             string RPath  = args[0];
             string WPath  = args[1];
             string WExt   = args[2];
             BGRImg Source = BGRImg.From(RPath);
             Source.LaplaceFilter();
             Source.ToImage().Save(WPath, ImgF.ChooseImgFormat(WExt));
             Environment.Exit(0);
         }
         else
         {
             Environment.Exit(1);
         }
     } catch {
         Environment.Exit(2);
     }
 }
 static void Main(string[] args)
 {
     try {
         if (args.Length >= 4)
         {
             string RPath  = args[0];
             string WPath  = args[1];
             string WExt   = args[2];
             double Length = Convert.ToDouble(args[3]);
             double Lambda = Convert.ToDouble(args[4]);
             BGRImg Source = BGRImg.From(RPath);
             Source.SimpleMotionDeblur(Length, Lambda).ToImage().Save(WPath, ImgF.ChooseImgFormat(WExt));
             Environment.Exit(0);
         }
         else
         {
             Environment.Exit(1);
         }
     } catch (Exception ex) {
         Console.WriteLine(ex.ToString());
         Environment.Exit(2);
     }
 }
 static void Main(string[] args)
 {
     try {
         if (args.Length >= 3)
         {
             string RPath  = args[0];
             string WPath  = args[1];
             string WExt   = args[2];
             BGRImg Source = BGRImg.From(RPath);
             BGRImg Result = Source.Extend();
             Result.BFFTShift();
             Result.FFT2();
             Result.ToImage(true).Save(WPath, ImgF.ChooseImgFormat(WExt));
             Environment.Exit(0);
         }
         else
         {
             Environment.Exit(1);
         }
     } catch (Exception ex) {
         Console.WriteLine(ex.ToString());
         Environment.Exit(2);
     }
 }