Example #1
0
 private Statistic CalculateStatistic(Classifier classifier, Action<int> report)
 {
     var statistic = new Statistic(classifier.ScaleFactor, classifier.MinNeighbours);
     var stopWatch = new Stopwatch();
     stopWatch.Start();
     for (var i = 0; i < images_.Length; ++i)
     {
         var testimage = images_[i];
         testimage.DetectedAreas.Clear();
         testimage.DetectedAreas.AddRange(classifier.Detect(testimage.GrayImage));
         statistic.ProcessSigns(testimage.SignsAreas.ToArray(), testimage.DetectedAreas.ToArray());
         report(i);
         if (slowcheckbox_.Checked)
             Thread.Sleep(1000);
     }
     stopWatch.Stop();
     statistic.Time = stopWatch.ElapsedMilliseconds / 1000;
     return statistic;
 }
Example #2
0
        private Statistic CalculateStatistic(Classifier classifier, Action <int> report)
        {
            var statistic = new Statistic(classifier.ScaleFactor, classifier.MinNeighbours);
            var stopWatch = new Stopwatch();

            stopWatch.Start();
            for (var i = 0; i < images_.Length; ++i)
            {
                var testimage = images_[i];
                testimage.DetectedAreas.Clear();
                testimage.DetectedAreas.AddRange(classifier.Detect(testimage.GrayImage));
                statistic.ProcessSigns(testimage.SignsAreas.ToArray(), testimage.DetectedAreas.ToArray());
                report(i);
                if (slowcheckbox_.Checked)
                {
                    Thread.Sleep(1000);
                }
            }
            stopWatch.Stop();
            statistic.Time = stopWatch.ElapsedMilliseconds / 1000;
            return(statistic);
        }
Example #3
0
 private void RunDetectionAsync(object sender, DoWorkEventArgs e)
 {
     var worker = (BackgroundWorker)sender;
     var configuration = (RunConfiguration)e.Argument;
     using (var classifier = new Classifier())
     {
         classifier.ScaleFactor = configuration.Scale;
         classifier.MinNeighbours = configuration.MinNeighbours;
         CalculateStatistic(classifier, worker.ReportProgress);
     }
 }