Algorithmix.Preprocessing.Preprocessing.Orient_Step2 C# (CSharp) Метод

Orient_Step2() публичный статический Метод

public static Orient_Step2 ( Bitmap blob ) : Bitmap
blob System.Drawing.Bitmap
Результат System.Drawing.Bitmap
        public static Bitmap Orient_Step2(Bitmap blob)
        {
            int width = blob.Width;
            int height = blob.Height;
            int area = width * height;
            Image<Bgra, Byte> blobb = new Image<Bgra, byte>(blob);
            Rectangle crop = GetCropZone(blobb);
            System.Drawing.Point trPoint = new System.Drawing.Point(crop.Right, crop.Top);
            System.Drawing.Point blPoint = new System.Drawing.Point(crop.Right, crop.Bottom);
            double slope = Utility.SlopeFromPoints(trPoint, blPoint);
            double angle = Math.Atan(slope);
            float angleToRotate = (float)(90.0 - angle);
            Bitmap rotated = RotateImg(blobb.ToBitmap(), angleToRotate, Color.Transparent);
            if (rotated.Height < rotated.Width)
            {
                return RotateImg(blobb.ToBitmap(), angleToRotate + 90, Color.Transparent);
            }
            return rotated;
        }