예제 #1
0
        private Bitmap DrawCircles(Image <Rgb, byte> img)
        {
            var settings = new CalculatorSettings()
            {
                Color             = ChoosenColor_PictureBox.BackColor,
                Threshold         = Convert.ToInt32(Threshold_UpDown.Value),
                NumberOfTriangles = Convert.ToInt32(Triangles_UpDown.Value)
            };

            Calculator = new CircumscribedCirclesFinder(img, settings);

            var l = Calculator.FindTriangleContour();

            foreach (var el in l)
            {
                img.Draw(el.Circle, new Rgb(0, 0, 255), 2);

                var label = new Label
                {
                    Location  = PointScaler.ScaleToPictureBox(el.LabelPosition),
                    Text      = el.Index.ToString(),
                    AutoSize  = true,
                    Visible   = true,
                    ForeColor = ChoosenColor_PictureBox.BackColor.InvertColor(),
                    BackColor = Color.Transparent
                };

                Image_PictureBox.Controls.Add(label);
            }
            return(img.ToBitmap());
        }
예제 #2
0
 public Calculator(CalculatorSettings settings, SiteContext context)
 {
     this.settings         = settings;
     _context              = context;
     CommaDecimalSeparator = settings.CommaDecimalSeparator;
 }