Ejemplo n.º 1
0
 /// <summary>
 /// Remove lines or borders using Leptonica library.
 /// </summary>
 /// <param name="image"></param>
 /// <returns></returns>
 public static Bitmap RemoveLines(Bitmap image)
 {
     using (Pix pix = PixConverter.ToPix(image))
     {
         // remove horizontal lines
         using (Pix result = pix.RemoveLines())
         {
             // rotate 90 degrees CW
             using (Pix result1 = result.Rotate90(1))
             {
                 // effectively remove vertical lines
                 using (Pix result2 = result1.RemoveLines())
                 {
                     // rotate 90 degrees CCW
                     using (Pix result3 = result2.Rotate90(-1))
                     {
                         return(PixConverter.ToBitmap(result3));
                     }
                 }
             }
         }
     }
 }