Example #1
0
        public BinaryImage Copy()
        {
            var copy = new BinaryImage(Width, Height);

            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    copy.SetPixel(x, y, this.GetPixel(x, y));
                }
            }

            return(copy);
        }
Example #2
0
        public BinaryImage GetBinaryImage()
        {
            var output = new BinaryImage(Width, Height);

            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    output.SetPixel(x, y, ColorToByte(_imageData[x, y]) != 0);
                }
            }

            return(output);
        }
Example #3
0
        public BinaryImage FindShapes()
        {
            var output = new BinaryImage(Width, Height);

            Queue <(int, int)> queue = new Queue <(int, int)>();

            for (int x = 0; x < this.Width; x++)
            {
                for (int y = 0; y < this.Height; y++)
                {
                    while (queue.Count != 0)
                    {
                        var cell = queue.Dequeue();
                        CheckCell(output, cell.Item1, cell.Item2, queue);
                    }

                    CheckCell(output, x, y, queue);
                }
            }

            return(output);
        }
Example #4
0
 private void CheckCell(BinaryImage output, int x, int y, Queue <(int, int)> queue)