Beispiel #1
0
        public void DoDetection(dOnDetectObject cb, bool debug, int minSize)
        {
            bool stayInLoop = true;

            #region theLoop
            SlowDown slowdown = new SlowDown();
            for (int y = 0; ((stayInLoop) && (y < Pic.getDimenion().Height)); y++)
            {
                for (int x = 0; ((stayInLoop) && (x < Pic.getDimenion().Width)); x++)
                {
                    slowdown.Next();

                    PixelInfo i = Pic.getPixel(x, y);
                    switch (i)
                    {
                    case PixelInfo.White:
                        ObjectPoints whites = new ObjectPoints(i);
                        onPoint_AddInvalidateExpand(whites, x, y);
                        whites.DoneAdding();
                        WhiteObjectList.Add(whites);
                        onDebug(debug, minSize, whites);
                        if (!cb(whites, Pic))
                        {
                            stayInLoop = false;
                        }
                        break;

                    case PixelInfo.Black:
                        ObjectPoints black = new ObjectPoints(i);
                        onPoint_AddInvalidateExpand(black, x, y);
                        black.DoneAdding();
                        BlackObjectList.Add(black);
                        onDebug(debug, minSize, black);
                        if (!cb(black, Pic))
                        {
                            stayInLoop = false;
                        }
                        break;

                    case PixelInfo.Processed:
                        break;

                    default:
                        break;
                    }
                }
            }
            #endregion
        }
Beispiel #2
0
        public MyPic(Size Size, PixelInfo backgroundColor)
        {
            this.Size      = Size;
            this.pTreshold = MyPicPixelInfoEnum.e3_mid;
            PixelInfoArray = new MyPicPixelInfoEnum[(Size.Width * Size.Height) + 1];
            SlowDown slowDown = new SlowDown();

            for (int y = 0; y < Size.Height; y++)
            {
                for (int x = 0; x < Size.Width; x++)
                {
                    slowDown.Next();
                    setPixel(x, y, backgroundColor);
                }
            }
        }