Example #1
0
        Mat DrawSquaresMask(Mat frame)
        {
            var result = new Mat(frame.Size(), MatType.CV_8U, Scalar.Black);

            for (int col = 0; col < 8; col++)
            {
                for (int row = 0; row < 8; row++)
                {
                    var squarePoints = OCVUtil.ToPoints(GetSquarePoints(row, col, SquareMaskScale));
                    Cv2.FillConvexPoly(result, squarePoints, Scalar.White);
                }
            }
            return(result);
        }
Example #2
0
        Mat DrawBackgroundModel(Mat frame)
        {
            var result = new Mat(frame.Size(), frame.Type());

            for (int col = 0; col < 8; col++)
            {
                for (int row = 0; row < 8; row++)
                {
                    var color        = IsWhiteSquare(row, col) ? WhiteSquareColor : BlackSquareColor;
                    var squarePoints = OCVUtil.ToPoints(GetSquarePoints(row, col));
                    Cv2.FillConvexPoly(result, squarePoints, color);
                }
            }
            return(result);
        }
Example #3
0
        public static void DrawSquareMask(int row, int col, Mat dest, Mat boardToImageTransform, double scale = 1.0)
        {
            var points = OCVUtil.ToPoints(GetSquarePoints(row, col, boardToImageTransform, scale));

            Cv2.FillConvexPoly(dest, points, Scalar.White);
        }