double IBinarization.ShewDetection(System.Drawing.Bitmap srcImage, Infrastructure.ShewDetectionType type) { Byte[] rgbBytes = LockBits(srcImage, System.Drawing.Imaging.ImageLockMode.ReadWrite); Int32 singleWidth = RealWidth / 3; Int32 length = singleWidth * Height; Byte[] data = new Byte[length]; for (int i = 0; i < Height; i++) { for (int j = 0; j < singleWidth; j++) { data[i * singleWidth + j] = rgbBytes[i * Width + j * 3]; } } UnlockBits(rgbBytes); Double angle = 0.0; if (type == Infrastructure.ShewDetectionType.Projection) { base.shewCorrectProjection(ref data, singleWidth, Height, out angle); } return(angle); }
System.Drawing.Bitmap IBinarization.ShewCorrection(System.Drawing.Bitmap srcImage, Infrastructure.ShewDetectionType type) { Double angle = ((IBinarization)this).ShewDetection(srcImage, type); return(((IBinarization)this).BileanerRotate(srcImage, 90 - angle)); }