Example #1
0
        private void Init(int slidingWindowSize, int outputImagePixelHeight, int outputImagePixelWidth)
        {
            _slidingWindowSize = slidingWindowSize;
            _width             = outputImagePixelWidth;
            _height            = outputImagePixelHeight;

            WhitePixels = new Pixel[_slidingWindowSize * _slidingWindowSize];
            Array.Fill(WhitePixels, White);

            Pixel[] pixels = new Pixel[_slidingWindowSize * _slidingWindowSize];
            WhitePixels.CopyTo(pixels, 0);
            for (int i = 1; i <= _slidingWindowSize; i++)
            {
                pixels[i * _slidingWindowSize - i] = Black;
            }
            ReverseDiagonalLine = pixels;

            pixels = new Pixel[_slidingWindowSize * _slidingWindowSize];
            WhitePixels.CopyTo(pixels, 0);
            for (int i = 0; i < _slidingWindowSize; i++)
            {
                pixels[i * _slidingWindowSize + i] = Black;
            }
            DiagonalLine = pixels;

            pixels = new Pixel[_slidingWindowSize * _slidingWindowSize];
            int minIdx = (_slidingWindowSize / 2 - (_slidingWindowSize % 2 == 0 ? 1 : 0)) * _slidingWindowSize - 1,
                maxIdx = ((_slidingWindowSize / 2) + 1) * _slidingWindowSize;

            for (int i = 0; i < pixels.Length; i++)
            {
                if (!(i > minIdx && i < maxIdx))
                {
                    pixels[i] = White;
                }
            }
            HorizontalLine = pixels;

            pixels = new Pixel[_slidingWindowSize * _slidingWindowSize];
            HorizontalLine.CopyTo(pixels, 0);
            VerticalLine = Transpone(pixels);
        }