Exemple #1
0
        public Rectangle DetectEdges(Bitmap source)
        {
            var fastSource = new FastBitmap(source);

            fastSource.LockImage();

            var(X, Width)  = DetectVerticalLines(fastSource);
            var(Y, Height) = DetectHorizontalLines(fastSource);

            fastSource.UnlockImage();

            if (Width > 0 && Height > 0)
            {
                Width  -= 8;
                X      += 4;
                Height -= 8;
                Y      += 4;
                var rectangle = new Rectangle(X, Y, Width, Height);
                RectangleDetected?.Invoke(this, new RectangleEventArgs(rectangle));
                return(rectangle);
            }
            return(Rectangle.Empty);
        }
Exemple #2
0
 protected virtual void OnRectangleDetected(Point e)
 {
     RectangleDetected?.Invoke(this, e);
 }