public TekBoardAnalyzer(TekGridAnalyzer GridAnalyzer)
 {
     Borders    = new TekBorderAnalyzer(GridAnalyzer.matGrayScaleImage, GridAnalyzer.gridDef);
     Characters = new TekCharacterRecognition(GridAnalyzer.matGrayScaleImage, GridAnalyzer.gridDef);
     Board      = new TekBoard(GridAnalyzer.gridDef.Rows, GridAnalyzer.gridDef.Cols);
     InsertValues();
     InsertAreas();
 }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            GridAnalyzer  = new TekGridAnalyzer(imgOriginal);
            pbGray.Image  = GridAnalyzer.matGrayScaleImage.Bitmap;
            pbEdges.Image = GridAnalyzer.cannyEdges.Bitmap;

            lineImage = imgOriginal.CopyBlank();
            foreach (LineSegment2D line in GridAnalyzer.Lines)
            {
                lineImage.Draw(line, new Bgr(Color.LightGreen), 2);
            }
            pbLines.Image = lineImage.Bitmap;

            Image <Bgr, Byte> image3 = lineImage.CopyBlank();

            foreach (OCVCombinedLinesData line in GridAnalyzer.Grid.HorizontalLines)
            {
                OCVLineData summ = line.GetSummaryLine();
                image3.Draw(summ.Line, new Bgr(Color.Azure), 2);
            }
            foreach (OCVCombinedLinesData line in GridAnalyzer.Grid.VerticalLines)
            {
                OCVLineData summ = line.GetSummaryLine();
                if (summ.Length > 35)
                {
                    image3.Draw(summ.Line, new Bgr(Color.LightPink), 2);
                }
            }
            pbAnalyzed.Image = image3.Bitmap;


            using (GridSizeForm gridForm = new GridSizeForm())
            {
                gridForm.GridAnalyzer = GridAnalyzer;
                gridForm.LoadImage(imgOriginal);
                gridForm.SetGridDef(GridAnalyzer.gridDef);
                if (gridForm.ShowDialog() == DialogResult.OK)
                {
                    GridAnalyzer.gridDef = gridForm.GetGridDef();
                }
            }

            Image <Bgr, Byte> lineImage2 = imgOriginal.CopyBlank();

            DrawGrid(lineImage2, GridAnalyzer.gridDef, new Bgr(Color.White));
            pbGrid.Image = lineImage2.Bitmap;

            Image <Bgr, Byte> lineImage4 = imgOriginal.Copy();

            DrawGrid(lineImage4, GridAnalyzer.gridDef, new Bgr(Color.Purple));
            pbCombi.Image = lineImage4.Bitmap;

            tabControl1.SelectedTab = tbCombi;
        }