예제 #1
0
        private ColourDetectorOutput LocateColour()
        {
            var               output            = new ColourDetectorOutput();
            const int         captureBufferBurn = 2; // first image is stale, need to capture the second one
            Image <Bgr, byte> capturedImage     = null;

            for (int i = 0; i < captureBufferBurn; i++)
            {
                capturedImage = GetCameraCapture();
                //DoStep("Captured {0} image", i);
            }

            using (var capturedMat = capturedImage.Mat)
            {
                var colourDetectorInput = new ColourDetectorInput();
                colourDetectorInput.Captured         = capturedMat;
                colourDetectorInput.SetCapturedImage = false;
                colourDetectorInput.Settings         = Settings;

                output = _colourDetector.Process(colourDetectorInput);
            }

            if (ColourCaptured != null)
            {
                output.CapturedImage = capturedImage;
                ColourCaptured(this, output);
            }

            return(output);
        }
예제 #2
0
 void _calibratingPanTiltController_ColourCaptured(object sender, ColourDetectorOutput e)
 {
     if (e.IsDetected)
     {
         DrawReticle(e.CapturedImage, e.CentralPoint.ToPoint(), Color.Yellow);
     }
     DrawReticle(e.CapturedImage, _captureConfig.Resolution.GetCenter(), Color.Red);
     WriteText(e.CapturedImage, 10, _calibratingPanTiltController.CurrentSetting.ToString());
     imageBoxCaptured.Image = e.CapturedImage;
 }
예제 #3
0
 public void Absorb(ColourDetectorOutput output)
 {
     _isDetected    = output.IsDetected;
     MomentArea     = output.MomentArea;
     ThresholdImage = output.ThresholdImage;
 }