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); }
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; }
public void Absorb(ColourDetectorOutput output) { _isDetected = output.IsDetected; MomentArea = output.MomentArea; ThresholdImage = output.ThresholdImage; }