public IEnumerable <Rectangle> From(IAddressableImage image) { labels = new int[image.Width, image.Height]; var rectangles = new List <Rectangle>(); Image = image; for (int x = 0; x < image.Width; x++) { for (int y = 0; y < image.Height; y++) { if (Image.MeetsThreshold(Image.GetPixel(x, y)) && labels[x, y] == 0) { var found = new LabeledPixel(x, y, currentLabel); labels[x, y] = currentLabel; if (!queue.Contains(found)) { queue.Enqueue(found); } ProcessQueue(x, y); } } } return(CreateRectangle()); }
private IEnumerable <Rectangle> GetRectangles(IAddressableImage image) { var blobFinder = new BlobFinder(); var sw = new Stopwatch(); sw.Start(); var rectangles = blobFinder.From(image); sw.Stop(); TimeToFindLetter = sw.Elapsed; return(rectangles); }
public void SetImage(IAddressableImage image) { this.image.Image = image.BaseImage.Clone() as Image; }