示例#1
0
        public void CamTracking(Mat curImg, VidLoc.RealTimeTrackLoc realTimeTrack, PreVidStream vidProvider, IDriver driver, BreakDiffDebugReporter debugReporter)
        {
            debugReporter.ReportInProcessing(true);
            results       = haar.Detect(curImg);
            result.Width  = 0;
            result.Height = 0;
            if (results != null && results.Length > 0)
            {
                results = results.OrderByDescending(r => r.Width * r.Height).ToArray();
                result  = results[0];
            }
            debugReporter.ReportInProcessing(false);
            realTimeTrack.CurPos = 0;
            DiffVect vect = new DiffVect();

            vect.Vector = realTimeTrack.vect;
            debugReporter.ReportStepChanges(new StepChangeReporter(curImg, results, result), vect);
            if (result.Width == 0)
            {
                //debugReporter.InfoReport($"NA");
                driver.Stop();
            }
            else
            {
                double diff = (curImg.Width / 2) - ((result.X + result.Width) / 2);
                //debugReporter.InfoReport($"{(diff > 0? "L":"R") } diff {diff.ToString("0.0")} imw ${((result.X + result.Width) / 2)}");
                realTimeTrack.vect = new DiffVector(diff, 0, 0);
                driver.Track(realTimeTrack);
            }
        }
示例#2
0
        public static DiffVect CompDiff(Mat input, Mat comp, BreakDiffDebugReporter reporter)
        {
            var processor = new ShiftVecProcessor(input, comp);
            var vect      = processor.GetAllDiffVect();

            if (reporter != null)
            {
                reporter.ReportStepChanges(processor, vect);
            }
            return(vect);
        }