Algorithmix.Forensics.EdgeDetector.ScanFromLeft C# (CSharp) Method

ScanFromLeft() public static method

public static ScanFromLeft ( Bitmap shred, Direction direction, double percentageIgnored = 0.15 ) : int[]
shred System.Drawing.Bitmap
direction Direction
percentageIgnored double
return int[]
        public static int[] ScanFromLeft(Bitmap shred, Direction direction, double percentageIgnored = 0.15)
        {
            int startHeight = (int) (percentageIgnored*(shred.Height));
            int stopHeight = (int) ((1 - percentageIgnored)*(shred.Height));
            int[] edgePoints = new int[shred.Height];
            using (Image<Bgra, byte> image = new Image<Bgra, byte>(shred))
            {
                for (int row = 0; row < image.Height; row++)
                {
                    if (row < startHeight || row >= stopHeight) // If we are in the ignore range
                    {
                        edgePoints[row] = IgnorePoint;
                    }
                    else // find the first none transperant point
                    {
                        for (int col = 0; col < image.Width; col++)
                        {
                            if (!(Math.Abs(image[row, col].Alpha - byte.MaxValue) < 0.0001)) continue;
                            edgePoints[row] = col;
                            break;
                        }
                    }
                }
            }
            return edgePoints;
        }