
'Declaration Public Class GetTesseractOcrTextOrientationCommand Inherits Vintasoft.Imaging.ImageProcessing.ProcessingCommandWithRegion
public class GetTesseractOcrTextOrientationCommand : Vintasoft.Imaging.ImageProcessing.ProcessingCommandWithRegion
public __gc class GetTesseractOcrTextOrientationCommand : public Vintasoft.Imaging.ImageProcessing.ProcessingCommandWithRegion
public ref class GetTesseractOcrTextOrientationCommand : public Vintasoft.Imaging.ImageProcessing.ProcessingCommandWithRegion
''' <summary> ''' Returns an orientation angle of document image using Tesseract OCR. ''' </summary> ''' <param name="filename">The path to a file with document image.</param> ''' <param name="tesseractOcrDllDirectory">A path to a directory, where Tesseract5.Vintasoft.xXX.dll files are located.</param> Public Shared Sub GetDocumentImageOrientationUsingTesseractOCR(filename As String, tesseractOcrDllDirectory As String) ' create an image collection Using images As New Vintasoft.Imaging.ImageCollection() ' add images from file to the image collection images.Add(filename) ' create an instance of GetTesseractOcrTextOrientationCommand class Using getTextOrientationCommand As New Vintasoft.Imaging.ImageProcessing.Ocr.Tesseract.GetTesseractOcrTextOrientationCommand() ' specify path to a directory, where Tesseract5.Vintasoft.xXX.dll files are located getTextOrientationCommand.TesseractOcrDllDirectory = tesseractOcrDllDirectory ' for each image in image collection For i As Integer = 0 To images.Count - 1 ' get image Dim image As Vintasoft.Imaging.VintasoftImage = images(i) ' determine orientation of document image using Tesseract OCR getTextOrientationCommand.ExecuteInPlace(image) ' write result to the console System.Console.WriteLine(String.Format("Filename: {0}, page: {1}, page orientation: {2}", System.IO.Path.GetFileName(filename), i, getTextOrientationCommand.Orientation)) Next End Using ' free images images.ClearAndDisposeItems() End Using End Sub
/// <summary> /// Returns an orientation angle of document image using Tesseract OCR. /// </summary> /// <param name="filename">The path to a file with document image.</param> /// <param name="tesseractOcrDllDirectory">A path to a directory, where Tesseract5.Vintasoft.xXX.dll files are located.</param> public static void GetDocumentImageOrientationUsingTesseractOCR(string filename, string tesseractOcrDllDirectory) { // create an image collection using (Vintasoft.Imaging.ImageCollection images = new Vintasoft.Imaging.ImageCollection()) { // add images from file to the image collection images.Add(filename); // create an instance of GetTesseractOcrTextOrientationCommand class using (Vintasoft.Imaging.ImageProcessing.Ocr.Tesseract.GetTesseractOcrTextOrientationCommand getTextOrientationCommand = new Vintasoft.Imaging.ImageProcessing.Ocr.Tesseract.GetTesseractOcrTextOrientationCommand()) { // specify path to a directory, where Tesseract5.Vintasoft.xXX.dll files are located getTextOrientationCommand.TesseractOcrDllDirectory = tesseractOcrDllDirectory; // for each image in image collection for (int i = 0; i < images.Count; i++) { // get image Vintasoft.Imaging.VintasoftImage image = images[i]; // determine orientation of document image using Tesseract OCR getTextOrientationCommand.ExecuteInPlace(image); // write result to the console System.Console.WriteLine(string.Format("Filename: {0}, page: {1}, page orientation: {2}", System.IO.Path.GetFileName(filename), i, getTextOrientationCommand.Orientation)); } } // free images images.ClearAndDisposeItems(); } }
System.Object
Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
Vintasoft.Imaging.ImageProcessing.ProcessingCommandWithRegion
Vintasoft.Imaging.ImageProcessing.Ocr.Tesseract.GetTesseractOcrTextOrientationCommand
Target Platforms: .NET 6; .NET 5; .NET Core 3.1; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5