示例#1
0
        public void Init(PictureBox ibOriginal, PictureBox ibDetected, PictureBox ibDraw, int tableCalibX, int tableCalibY, int tableCalibSens, int nextPieceCalibX, int nextPieceCalibY, int nextPieceCalibSens, string fontType) //Inicializálás
        {
            try
            {
                calOk           = false;
                newGame         = true;
                this.ibOriginal = ibOriginal;
                this.ibDetected = ibDetected;
                this.ibDraw     = ibDraw;

                this.tableCalibX        = tableCalibX;
                this.tableCalibY        = tableCalibY;
                this.tableCalibSens     = tableCalibSens;
                this.nextPieceCalibX    = nextPieceCalibX;
                this.nextPieceCalibY    = nextPieceCalibY;
                this.nextPieceCalibSens = nextPieceCalibSens;

                /*tableCalibX = 17;
                 * tableCalibY = 452;
                 * tableCalibSens = 40;
                 * nextPieceCalibX = 574;
                 * nextPieceCalibY = 359;
                 * nextPieceCalibSens = 10;*/

                calib                                = new Calibrator(tableCalibSens, tableCalibX, tableCalibY);
                ocr                                  = new CharacterDetector();
                ocr.equalizeHist                     = false;
                ocr.finder.maxRotateAngle            = Math.PI;
                ocr.minContourArea                   = 10;
                ocr.minContourLength                 = 15;
                ocr.finder.maxACFDescriptorDeviation = 4;
                ocr.finder.minACF                    = 0.96;
                ocr.finder.minICF                    = 0.85;
                ocr.blur                             = true;
                ocr.noiseFilter                      = false;
                ocr.cannyThreshold                   = 50;
                ocr.adaptiveThresholdBlockSize       = 4;
                ocr.adaptiveThresholdParameter       = 1.5;
                ocr.templates.Clear();
                TemplateGenerator.GenerateChars(ocr, new char[] { 'X', 'O' }, new System.Drawing.Font(new FontFamily(fontType), 100, FontStyle.Regular));

                status  = GameStatus.Online;
                capture = new Capture();
                capture.ImageGrabbed += ProcessFrame;
                OnGameStatusChanged(GameStatus.Online);
                prevPiece = false;
                nextPiece = false;
            }
            catch
            {
                OnGameStatusChanged(GameStatus.Offline); //Ha a kamera nem található.
            }
        }
示例#2
0
        public void Init(Emgu.CV.UI.ImageBox ibOriginal, Emgu.CV.UI.ImageBox ibDetected /*, EventHandler<Interface.CameraStatusChangedEventArgs> esemeny*/)
        {
            try
            {
                //CameraStatusChanged += esemeny;
                calOk                                      = false;
                newGame                                    = true;
                this.ibOriginal                            = ibOriginal;
                this.ibDetected                            = ibDetected;
                calib                                      = new Calibrator(40, 43, 429);
                captureInProgress                          = true;
                detectGrid                                 = true;
                detectXO                                   = true;
                rotate                                     = false;
                processor                                  = new ImageProcessor();
                processor.equalizeHist                     = false;
                processor.finder.maxRotateAngle            = Math.PI;
                processor.minContourArea                   = 10;
                processor.minContourLength                 = 15;
                processor.finder.maxACFDescriptorDeviation = 4;
                processor.finder.minACF                    = 0.96;
                processor.finder.minICF                    = 0.85;
                processor.blur                             = true;
                processor.noiseFilter                      = false;
                processor.cannyThreshold                   = 50;
                processor.adaptiveThresholdBlockSize       = 4;
                processor.adaptiveThresholdParameter       = 1.5;
                processor.templates.Clear();
                TemplateGenerator.GenerateChars(processor, new char[] { 'X', 'O' }, new System.Drawing.Font(new FontFamily("Consolas"), 100, FontStyle.Regular));

                status   = CameraStatus.Online;
                statusOk = false;

                capture = new Capture();
                capture.ImageGrabbed += ProcessFrame2;
                OnCameraStatusChanged(CameraStatus.Online);
                prevPiece = false;
                nextPiece = false;
            }
            catch (Exception ex)
            {
                OnCameraStatusChanged(CameraStatus.Offline);
            }
        }
示例#3
0
 public void NewGame() //Új játék indítása.
 {
     calib   = new Calibrator(tableCalibSens, tableCalibX, tableCalibY);
     newGame = true;
     calOk   = false;
 }
示例#4
0
 public void NewGame()
 {
     calib   = new Calibrator(100, 43, 429);
     newGame = true;
     calOk   = false;
 }