private void buttonLoad_Click(object sender, EventArgs e) { try { OpenFileDialog Dlg = new OpenFileDialog(); Dlg.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; Dlg.FilterIndex = 1; Dlg.CheckFileExists = true; Dlg.RestoreDirectory = false; if (Dlg.ShowDialog() == DialogResult.OK) { listBoxImg.Items.Clear(); Cursor = Cursors.WaitCursor; _ImgCol = new LabeledImageCollection(Dlg.FileName); foreach (LabeledImg img in _ImgCol.ImgList) { listBoxImg.Items.Add(img); } Text = Dlg.FileName; Cursor = Cursors.Default; } } catch (Exception ex) { Cursor = Cursors.Default; if (ex.InnerException != null) { MessageBox.Show(ex.InnerException.Message, ex.Message); } else { MessageBox.Show(ex.Message); } } }
private void ReportUsingFeatures(string suiteFile) { FileInfo fileInfo = new FileInfo(suiteFile); if (false == fileInfo.Exists) { return; } LabeledImageCollection labelCol = new LabeledImageCollection(suiteFile); int imageCount = 0; int processedCount = 0; foreach (LabeledImg image in labelCol.ImgList) { imageCount += ReportFileUsingFeats(image.FileName, image.FeaturePtsList); ++processedCount; Console.Write("\rGenerated {0} Images. Processed {1} / {2} Images", imageCount, processedCount, labelCol.ImgList.Count); } Console.WriteLine(""); }