private void figureClick(object sender, EventArgs e) { Bitmap bm = new Bitmap(segmentBox.Image); // Image<Rgb, byte> redImg2 = new Image<Rgb, Byte>(bm); Image <Rgb, byte> redImg2 = new Image <Rgb, Byte>(bm); Button btn = (Button)sender; int what = Convert.ToInt32(btn.Tag); bool draw = true; //line double cth = Convert.ToDouble(cannyThreshold.Text); double cthlink = Convert.ToDouble(cannyThreshLinking.Text); //circle double accum = Convert.ToDouble(cannyCircleAccum.Text); double dp = Convert.ToDouble(dpbox.Text); double minDist = Convert.ToDouble(minDistbox.Text); double minRadio = Convert.ToDouble(minRadiobox.Text); //lines double rho = Convert.ToDouble(rhoBox.Text); double threshold = Convert.ToDouble(thresholdbox.Text); double minWithLine = Convert.ToDouble(minWidthbox.Text); double gap = Convert.ToDouble(gapbox.Text); //trianRect double epsilonFact = Convert.ToDouble(epsilonBox.Text); double minArea = Convert.ToDouble(minAreabox.Text); imagen.args = new double[] { cth, cthlink, accum, dp, minDist, minRadio, rho, threshold, minWithLine, gap, epsilonFact, minArea }; imagen.detect = new Detector(); imagen.BeginDetection(ref redImg2, what, draw); redImg2 = imagen.detect.figure[what]; richTextBox1.Text = imagen.detect.msgBuilder.ToString(); imagen.detect.msgBuilder.Clear(); segmentBox.Image = redImg2.Bitmap; }