protected override void Draw() { if (!SelectedPatch.x0.HasValue || !SelectedPatch.y0.HasValue) { return; } Rectangle crop; var mask = _map.GetMask(SelectedPatch.x0.Value, SelectedPatch.y0.Value, out crop, GetPatchScale()); mask = mask.Canny(new Gray(149), new Gray(255)).Dilate(5); // draw the mask on the image DisplayedImage.ROI = crop; for (int i = 0; i < mask.Rows; i++) { for (int j = 0; j < mask.Cols; j++) { if ((float)mask[i, j].Intensity > 0) { DisplayedImage.Data[crop.Top + i, crop.Left + j, 0] = 255; DisplayedImage.Data[crop.Top + i, crop.Left + j, 1] = 255; DisplayedImage.Data[crop.Top + i, crop.Left + j, 2] = 0; //new Rgb(Color.Yellow); } } } DisplayedImage.ROI = Rectangle.Empty; DisplayedImage.Draw(crop, new Rgb(Color.Wheat), 1); // draw markers DrawMarker(SelectedPatch.x0.Value, SelectedPatch.y0.Value, new Rgb(Color.DodgerBlue)); DrawCenterMarker(); }