Esempio n. 1
0
        void ProcessFrame()
        {
            List<CvPoint> rects = SquareDetector.FindRectangles(lastFrame);

            PieceInfo[] pieces = GetPieces(rects);

            PieceInfo[,] layout = LayoutPieces(pieces);
            if (layout != null && lastLayout == null)
            {
                lastLayout = layout;
                NotifyClick();

                int[,] colors = new int[9,3];
                for (int i = 0; i < 9; i++)
                {
                    int[] color = layout[i / 3, i % 3].color;
                    colors[i, 0] = color[0];
                    colors[i, 1] = color[1];
                    colors[i, 2] = color[2];
                }

                CaptureClickEventArgs e = new CaptureClickEventArgs(colors);
                OnCaptureClick(e);
            }

            DrawSquares(rects, pieces, window);
        }
Esempio n. 2
0
 private void OnCaptureClick(CaptureClickEventArgs e)
 {
     if (CaptureClick != null) CaptureClick(this, e);
 }