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); }
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); }
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); }
private void CheckCell(BinaryImage output, int x, int y, Queue <(int, int)> queue)