private void cmbType_SelectedIndexChanged(object sender, EventArgs e) { tmrPlay.Enabled = false; lblNotice.Text = ""; btnImgPlay.Text = "Play"; cmbAlg.Items.Clear(); DetectionAlg[] algs = typeToAlg[cmbType.SelectedIndex]; if (algs.Length > 0) { for (int i = 0; i < algs.Length; i++) { cmbAlg.Items.Add(DetectionDesc.Alg(algs[i])); } cmbAlg.SelectedIndex = -1; } else { cmbAlg.Items.Add("No Algs Found"); cmbAlg.SelectedIndex = 0; } curImgList = typeToImgList[cmbType.SelectedIndex]; imgIndex = 0; imgMain.Image = ImgList.GetImageFromPath("UI\\PickAAlg.jpg"); lblWarning.Text = ""; }
//-------------------------------------------------------- #endregion #region Form Events //-------------------------------------------------------- private void Form2_Load(object sender, EventArgs e) { lblLoading.Visible = false; typeToAlg = new DetectionAlg[NUM_DET_TYPES][]; typeToAlg[(int)DetectionType.PEDESTRIAN] = new DetectionAlg[] { DetectionAlg.PED_HOG }; typeToAlg[(int)DetectionType.STOP] = new DetectionAlg[] { DetectionAlg.STOPSIGN_SURF, DetectionAlg.STOPSIGN_INT_IMG, DetectionAlg.STOPSIGN_OCT, }; typeToAlg[(int)DetectionType.WARNING] = new DetectionAlg[] { DetectionAlg.WARN_OSURF, DetectionAlg.WARN_SURF, }; for (int i = 0; i < NUM_DET_TYPES; i++) { cmbType.Items.Add(DetectionDesc.Type((DetectionType)i)); } cmbType.SelectedIndex = -1; typeToImgList = new ImgList[NUM_DET_TYPES]; for (int i = 0; i < NUM_DET_TYPES; i++) { typeToImgList[i] = new ImgList((DetectionType)i); } imgIndex = 0; curImgList = null; algToDetector = new Dictionary <DetectionAlg, Detector>() { { DetectionAlg.PED_HOG, new HogPedestrianDetector() }, { DetectionAlg.STOPSIGN_INT_IMG, new IntegralImageStopSignDetector() }, { DetectionAlg.STOPSIGN_OCT, new OctagonStopSignDetector() }, { DetectionAlg.STOPSIGN_SURF, new SurfStopSignDetector() }, { DetectionAlg.WARN_OSURF, new OrientedSurfWarningSignDetector() }, { DetectionAlg.WARN_SURF, new SurfWarningSignDetector() }, }; algToPrecision = new Dictionary <DetectionAlg, double>() { { DetectionAlg.PED_HOG, -1 }, { DetectionAlg.STOPSIGN_INT_IMG, 35 / 52d }, { DetectionAlg.STOPSIGN_OCT, -1 }, { DetectionAlg.STOPSIGN_SURF, 9 / 52d }, { DetectionAlg.WARN_OSURF, 38 / 61d }, { DetectionAlg.WARN_SURF, 26 / 61d } }; imgMain.Image = ImgList.GetImageFromPath("UI\\PickAType.jpg"); curStats = new Stats(); prevStats = curStats; calcStatProgress = 0; firstStatRun = true; statThread = null; statThreadKill = false; btnFocus.Focus(); }