예제 #1
0
        private void btnProcess_Click(object sender, EventArgs e)
        {
            switch (lbMethods.SelectedIndex)
            {
            case (int)Methods.none:
                break;

            case (int)Methods.Susan:
                SusanCornerProperties sp = ControlPanel.Controls[0] as SusanCornerProperties;

                processing = new FrmProcessing("Conducting Susan Edge Detection");
                processing.Show();
                Log("Conducting Susan Edge Detection");
                SetStatus("Please wait for edge detection");
                Susan s = new Susan(CurrentImage);
                s.ImageComplete += s_ImageComplete;
                Task t = new Task(() => s.GetCorners(sp.DifferenceThreshold, sp.GeometricalThreshold));
                t.Start();

                break;

            default:
                break;
            }
        }
 private void ImageCornerDetectionCompleted(List <IntPoint> Corners, Color colour)
 {
     if (this.processing != null)
     {
         if (this.processing.InvokeRequired)
         {
             ImageCompleteDelegate d = new ImageCompleteDelegate(s_ImageComplete);
             this.Invoke(d, new object[] { Corners });
         }
         else
         {
             this.processing.Close();
             this.processing = null;
         }
     }
     Log("Detection Finished");
     SetStatus(Corners.Count + " corners detected", true);
     DrawCorners(Corners, colour);
     if (ssw != null && ssw.IsRunning)
     {
         ssw.Stop();
         Log("Process Duration in Seconds: " + ssw.Elapsed);
     }
     if (smw != null && smw.IsRunning)
     {
         smw.Stop();
         Log("Process Duration in Seconds: " + smw.Elapsed);
     }
 }
예제 #3
0
        private void Delete()
        {
            FrmProcessing          frmP       = new FrmProcessing();
            string                 msg        = string.Empty;
            List <DataGridViewRow> deleteRows = new List <DataGridViewRow>();
            Action action = delegate()
            {
                try
                {
                    int success           = 0;
                    int fail              = 0;
                    WaitingCommandBLL bll = new WaitingCommandBLL(AppSettings.CurrentSetting.ParkConnect);
                    foreach (DataGridViewRow item in this.GridView.SelectedRows)
                    {
                        if (item.Tag is WaitingCommandInfo)
                        {
                            WaitingCommandInfo info = item.Tag as WaitingCommandInfo;
                            BusinessModel.Enum.WaitingCommandStatus oldStatus = info.Status;
                            info.Status = BusinessModel.Enum.WaitingCommandStatus.Waiting;
                            if (bll.Delete(info).Result == ResultCode.Successful)
                            {
                                success++;
                                deleteRows.Add(item);
                            }
                            else
                            {
                                fail++;
                            }
                        }
                        msg = string.Format(Resource1.Form_Total + ":{0}/{1} " + Resource1.Form_Success + ":{2} " + Resource1.Form_Fail + ":{3}", success + fail, this.GridView.SelectedRows.Count, success, fail);
                        frmP.ShowProgress(msg, (success + fail) / this.GridView.SelectedRows.Count);
                    }
                }
                catch (ThreadAbortException)
                {
                }
                catch (Exception ex)
                {
                    frmP.ShowProgress(ex.Message, 1);
                }
            };
            Thread t = new Thread(new ThreadStart(action));

            t.CurrentCulture   = Thread.CurrentThread.CurrentCulture;
            t.CurrentUICulture = Thread.CurrentThread.CurrentUICulture;
            t.Start();
            if (frmP.ShowDialog() != DialogResult.OK)
            {
                t.Abort();
            }
            if (!string.IsNullOrEmpty(msg))
            {
                foreach (DataGridViewRow item in deleteRows)
                {
                    this.GridView.Rows.Remove(item);
                }
                MessageBox.Show(msg);
            }
        }
예제 #4
0
        public static void ShowProcessing(string msg, Form owner, ParameterizedThreadStart work, object workArg = null)
        {
            FrmProcessing processingForm = new FrmProcessing(msg);
            dynamic       expObj         = new ExpandoObject();

            expObj.Form    = processingForm;
            expObj.WorkArg = workArg;
            processingForm.SetWorkAction(work, expObj);
            processingForm.ShowDialog(owner);
            if (processingForm.WorkException != null)
            {
                throw processingForm.WorkException;
            }
        }
예제 #5
0
        private void SusanCornerDetection()
        {
            swSusan.Reset();             // Used for timing functions. (good for testing changes in optimisation)
            swSusan.Start();
            SusanCornerProperties sp = ControlPanel.Controls[0] as SusanCornerProperties;

            processing = new FrmProcessing("Conducting Susan Corner Detection");
            processing.Show();
            Log("Conducting Susan Corner Detection");
            SetStatus("Please wait for corner detection");
            Susan s = new Susan(CurrentImage);

            s.ImageComplete += s_ImageComplete;

            Task st = new Task(() => s.GetCorners(sp.DifferenceThreshold, sp.GeometricalThreshold));

            st.Start();
        }
예제 #6
0
        private void MoravecCornerDetection()
        {
            swMoravec.Reset();             // Used for timing functions. (good for testing changes in optimisation)
            swMoravec.Start();
            MoravecCornerProperties mp = ControlPanel.Controls[0] as MoravecCornerProperties;

            processing = new FrmProcessing("Conducting Moravec Corner Detection");
            processing.Show();
            Log("Conducting Moravec Corner Detection");
            SetStatus("Please wait for corner detection");
            Moravec m = new Moravec(CurrentImage);

            m.ImageComplete += m_ImageComplete;
            m.LogMessage    += m_LogMessage;
            Task mt = new Task(() => m.GetCorners(mp.Threshold, mp.Window));

            mt.Start();
        }
예제 #7
0
        private void HarrisCornerDetection()
        {
            swHarris.Reset();             // Used for timing functions. (good for testing changes in optimisation)
            swHarris.Start();
            HarrisCornerProperties hp = ControlPanel.Controls[0] as HarrisCornerProperties;

            processing = new FrmProcessing("Conducting Harris Corner Detection");
            processing.Show();
            Log("Conducting Harris Corner Detection");
            SetStatus("Please wait for corner detection");
            Harris h = new Harris(CurrentImage);

            h.ImageComplete += h_ImageComplete;

            Task ht = new Task(() => h.GetCorners(hp.Threshold, hp.Sigma));

            ht.Start();
        }
예제 #8
0
        private void FASTCornerDetection()
        {
            swFast.Reset();             // Used for timing functions. (good for testing changes in optimisation)
            swFast.Start();
            FASTCornerProperties fp = ControlPanel.Controls[0] as FASTCornerProperties;

            processing = new FrmProcessing("Conducting FAST Corner Detection");
            processing.Show();
            Log("Conducting FAST Corner Detection");
            SetStatus("Please wait for corner detection");
            FAST f = new FAST(CurrentImage);

            f.ImageComplete += f_ImageComplete;

            Task ht = new Task(() => f.GetCorners(fp.Threshold, fp.Supress));

            ht.Start();
        }
예제 #9
0
 private void s_ImageComplete(List <IntPoint> Corners)
 {
     if (processing != null)
     {
         if (processing.InvokeRequired)
         {
             ImageCompleteDelegate d = new ImageCompleteDelegate(s_ImageComplete);
             this.Invoke(d, new object[] { Corners });
         }
         else
         {
             processing.Close();
             processing = null;
         }
     }
     Log("Detection Finished");
     SetStatus(Corners.Count + " corners detected", true);
     DrawCorners(Corners);
 }
        private void btnProcess_Click(object sender, EventArgs e)
        {
            switch (lbMethods.SelectedIndex)
            {
            case (int)Methods.none:
                break;

            case (int)Methods.Susan:
                ssw = new Stopwatch();                         // Used for timing functions. (good for testing changes in optimisation)
                SusanCornerProperties sp = ControlPanel.Controls[0] as SusanCornerProperties;
                processing = new FrmProcessing("Conducting Susan Corner Detection");
                processing.Show();
                Log("Conducting Susan Corner Detection");
                SetStatus("Please wait for corner detection");
                Susan s = new Susan(CurrentImage);
                s.ImageComplete += s_ImageComplete;
                Task st = new Task(() => s.GetCorners(sp.DifferenceThreshold, sp.GeometricalThreshold));
                ssw.Start();
                st.Start();
                break;

            case (int)Methods.Moravec:
                smw = new Stopwatch();                         // Used for timing functions. (good for testing changes in optimisation)
                MoravecCornerProperties mp = ControlPanel.Controls[0] as MoravecCornerProperties;
                processing = new FrmProcessing("Conducting Moravec Corner Detection");
                processing.Show();
                Log("Conducting Moravec Corner Detection");
                SetStatus("Please wait for corner detection");
                Moravec m = new Moravec(CurrentImage);
                m.ImageComplete += m_ImageComplete;
                m.LogMessage    += m_LogMessage;
                Task mt = new Task(() => m.GetCorners(mp.Threshold, mp.Window));
                smw.Start();
                mt.Start();
                break;

            default:
                break;
            }
        }
예제 #11
0
        private void ImageCornerDetectionCompleted(List <IntPoint> Corners, Color colour)
        {
            if (this.processing != null)
            {
                if (this.processing.InvokeRequired)
                {
                    ImageCompleteDelegate d = new ImageCompleteDelegate(ImageCornerDetectionCompleted);
                    this.Invoke(d, new object[] { Corners, colour });
                }
                else
                {
                    this.processing.Close();
                    this.processing = null;
                    DrawCorners(Corners, colour);

                    if (swSusan.IsRunning)
                    {
                        swSusan.Stop();
                        Log(Corners.Count.ToString("N0") + " SUSAN Corners Detected in " + swSusan.Elapsed);
                    }
                    else if (swHarris.IsRunning)
                    {
                        swHarris.Stop();
                        Log(Corners.Count.ToString("N0") + " Harris Corners Detected in " + swHarris.Elapsed);
                    }
                    else if (swMoravec.IsRunning)
                    {
                        swMoravec.Stop();
                        Log(Corners.Count.ToString("N0") + " Moravec Corners Detected in " + swMoravec.Elapsed);
                    }
                    else if (swFast.IsRunning)
                    {
                        swFast.Stop();
                        Log(Corners.Count.ToString("N0") + " FAST Corners Detected in " + swFast.Elapsed);
                    }
                }
            }
        }
예제 #12
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            this.UltraGrid1.DataSource = null;

            Globals.SearchType = this.rbBinarySearch.Checked ? "Byte" : "Filename";

            if (string.IsNullOrEmpty(this.inPath.Text.Trim()))
            {
                MessageBox.Show("Please select a start location.", "Invalid start location", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (System.IO.Directory.Exists(this.inPath.Text.Trim()) == false)
            {
                MessageBox.Show("It appears that the start location does not exist. Please select another location and try again.", "Bad Start Location", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (this.BackgroundWorker1.IsBusy == false)
            {
                GetAllCheckedBoxes();

                if (this.chkItems.Count > 0)
                {
                    Globals.dtFiles.Clear();
                    FrmProcessing frm = new FrmProcessing(this.inPath.Text.Trim(), this.chkSubDirectories.Checked, this.chkItems);
                    frm.LoadData += LoadData;
                    frm.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Please select file types to search for.", "Missing File Types", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
        }