Beispiel #1
0
 /// <summary>
 /// Process the specified bitmap image.
 /// </summary>
 /// <remarks>
 /// Please consider <see cref="Process(Pix image, Rect region, PageSegMode? pageSegMode)"/> instead. This is because
 /// this method must convert the bitmap to a pix for processing which will add additional overhead.
 /// Leptonica also supports a large number of image pre-processing functions as well.
 /// </remarks>
 /// <param name="image">The image to process.</param>
 /// <param name="region">The region of the image to process.</param>
 /// <param name="pageSegMode">The page segmentation mode.</param>
 /// <returns></returns>
 public Page Process(Bitmap image, Rect region, PageSegMode?pageSegMode = null)
 {
     using (var pix = PixConverter.ToPix(image))
     {
         return(Process(pix, region, pageSegMode));
     }
 }
        /// <summary>
        /// Process the specified bitmap image.
        /// </summary>
        /// <remarks>
        /// Please consider <see cref="TesseractEngine.Process(Pix, String, Rect, PageSegMode?)"/> instead. This is because
        /// this method must convert the bitmap to a pix for processing which will add additional overhead.
        /// Leptonica also supports a large number of image pre-processing functions as well.
        /// </remarks>
        /// <param name="image">The image to process.</param>
        /// <param name="inputName">Sets the input file's name, only needed for training or loading a uzn file.</param>
        /// <param name="region">The region of the image to process.</param>
        /// <param name="pageSegMode">The page segmentation mode.</param>
        /// <returns></returns>
        public Page Process(Bitmap image, string inputName, Rect region, PageSegMode?pageSegMode = null)
        {
            var pix  = PixConverter.ToPix(image);
            var page = Process(pix, inputName, region, pageSegMode);

            new PageDisposalHandle(page, pix);
            return(page);
        }
        /// <summary>
        /// Process the specified bitmap image.
        /// </summary>
        /// <remarks>
        /// Please consider <see cref="TesseractEngine.Process(Pix, String, Rect, PageSegMode?)"/> instead. This is because
        /// this method must convert the bitmap to a pix for processing which will add additional overhead.
        /// Leptonica also supports a large number of image pre-processing functions as well.
        /// </remarks>
        /// <param name="image">The image to process.</param>
        /// <param name="inputName">Sets the input file's name, only needed for training or loading a uzn file.</param>
        /// <param name="region">The region of the image to process.</param>
        /// <param name="pageSegMode">The page segmentation mode.</param>
        /// <returns></returns>
        public static Page Process(this TesseractEngine engine, Bitmap image, string inputName, Rect region, PageSegMode?pageSegMode = null)
        {
            var pix  = PixConverter.ToPix(image);
            var page = engine.Process(pix, inputName, region, pageSegMode);

            new TesseractEngine.PageDisposalHandle(page, pix);
            return(page);
        }