Esperanta OCR en C# kaj .NET

Aliaj versioj de ĉi tiu dokumento:

IronOCR estas programaro C#, kiu permesas al .NET-kodiloj legi tekston de bildoj kaj PDF-dokumentoj en 126 lingvoj, inkluzive Esperanton.

Ĝi estas altnivela forko de Tesseract, konstruita ekskluzive por la .NET-programistoj kaj regule superas aliajn Tesseract-motorojn pro rapideco kaj precizeco.

Enhavo de IronOcr.Languages.Esperanto

Ĉi tiu pako enhavas 52 OCR-lingvojn por .NET:

  • Esperanto
  • EsperantoBest
  • EsperantoFast

Elŝutu

Esperanto Language Pack [Esperanto]
* Download as Zip
* Install with https://www.nuget.org/packages/IronOcr.Languages.Esperanto/ NuGet

Instalado

La unua afero, kiun ni devas fari, estas instali nian esperantan OCR-pakon al via .NET-projekto.

PM> Install-Package IronOCR.Languages.Esperanto

Koda Ekzemplo

Ĉi tiu C#-koda ekzemplo legas Esperantan tekston de Bildo aŭ PDF-dokumento.

// PM> Install-Package IronOcr.Languages.Esperanto
using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Set the OCR language
};

// Load the OCR input
using (var Input = new OcrInput(@"images\Esperanto.png"))
{
    // Perform OCR and obtain results
    var Result = Ocr.Read(Input);

    // Retrieve all extracted text
    var AllText = Result.Text;
    // Output the extracted text
    Console.WriteLine(AllText);
}
// PM> Install-Package IronOcr.Languages.Esperanto
using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Set the OCR language
};

// Load the OCR input
using (var Input = new OcrInput(@"images\Esperanto.png"))
{
    // Perform OCR and obtain results
    var Result = Ocr.Read(Input);

    // Retrieve all extracted text
    var AllText = Result.Text;
    // Output the extracted text
    Console.WriteLine(AllText);
}
' PM> Install-Package IronOcr.Languages.Esperanto
Imports IronOcr

' Initialize the OCR engine
Private Ocr = New IronTesseract With {.Language = OcrLanguage.Esperanto}

' Load the OCR input
Using Input = New OcrInput("images\Esperanto.png")
	' Perform OCR and obtain results
	Dim Result = Ocr.Read(Input)

	' Retrieve all extracted text
	Dim AllText = Result.Text
	' Output the extracted text
	Console.WriteLine(AllText)
End Using
$vbLabelText   $csharpLabel

Kial Elekti IronOCR?

IronOCR estas facile instalebla, kompleta kaj bone dokumentita .NET-programaro.

Elektu IronOCR por atingi 99,8%+ OCR-precizecon sen uzi iujn eksterajn retservojn, daŭrantajn kotizojn aŭ sendi konfidencajn dokumentojn per interreto.

Kial programistoj de C# elektas IronOCR anstataŭ Vanilla Tesseract:

  • Instalu kiel unu DLL aŭ NuGet
  • Inkluzivas por Tesseract 5, 4 kaj 3 Motoroj el la skatolo.
  • Precizeco 99,8% signifance superas kutima Tesseract.
  • Flama Rapido kaj MultiThreading
  • MVC, WebApp, Labortablo, Konzolo kaj Servila Apliko kongrua
  • Neniu Exes aŭ C++-kodo por labori
  • Plena PDF-OCR-subteno
  • Por realigi OCR preskaŭ ajnan Bilddosieron aŭ PDF
  • Plena .NET Core, Standard kaj FrameWork subteno
  • Disvolvi en Vindozo, Mac, Linukso, Azure, Docker, Lambda, AWS
  • Legu strekokodojn kaj QR-kodojn
  • Eksporti OCR pri XHTML
  • Eksportu OCR al serĉeblaj PDF-dokumentoj
  • Multithreading-subteno
  • 126 internaciaj lingvoj ĉiuj administrataj per dosieroj NuGet aŭ OcrData
  • Ĉerpu Bildojn, Koordinatojn, Statistikojn kaj Tiparojn. Ne nur teksto.
  • Povas esti uzata por redistribui Tesseract OCR ene de komercaj kaj posedaj aplikoj.

Fera OCR brilas kiam vi laboras kun realmondaj bildoj kaj neperfektaj dokumentoj kiel fotoj aŭ skanaĵoj kun malalta distingivo, kiuj povas havi ciferecan bruon aŭ neperfektaĵojn.

Aliaj senpagaj OCR- bibliotekoj por la .NET-platformo tiaj aliaj .net-tesseract-APIoj kaj retservoj ne tiel bone funkcias en ĉi tiuj realaj uzokazoj.

OCR kun Tesseract 5 - Komencu Kodigi en C#

La koda specimeno sube montras kiel facile legi tekston de bildo per C# aŭ VB .NET.

OneLiner

// Perform OCR on a single line of code
string Text = new IronTesseract().Read(@"img\Screenshot.png").Text;
// Perform OCR on a single line of code
string Text = new IronTesseract().Read(@"img\Screenshot.png").Text;
' Perform OCR on a single line of code
Dim Text As String = (New IronTesseract()).Read("img\Screenshot.png").Text
$vbLabelText   $csharpLabel

Agordebla Salutmondo

// PM> Install-Package IronOCR.Languages.Esperanto
using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Add images to OCR input
using (var Input = new OcrInput())
{
    Input.AddImage("images/sample.jpeg");
    // Additional images can be added here
    var Result = Ocr.Read(Input);
    // Output the identified text
    Console.WriteLine(Result.Text);
}
// PM> Install-Package IronOCR.Languages.Esperanto
using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Add images to OCR input
using (var Input = new OcrInput())
{
    Input.AddImage("images/sample.jpeg");
    // Additional images can be added here
    var Result = Ocr.Read(Input);
    // Output the identified text
    Console.WriteLine(Result.Text);
}
' PM> Install-Package IronOCR.Languages.Esperanto
Imports IronOcr

' Initialize the OCR engine
Private Ocr = New IronTesseract With {.Language = OcrLanguage.Esperanto}

' Add images to OCR input
Using Input = New OcrInput()
	Input.AddImage("images/sample.jpeg")
	' Additional images can be added here
	Dim Result = Ocr.Read(Input)
	' Output the identified text
	Console.WriteLine(Result.Text)
End Using
$vbLabelText   $csharpLabel

C# PDF OCR

La sama aliro simile povas esti uzata por ĉerpi tekston de iu ajn PDF-dokumento.

using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Read from a PDF file
using (var input = new OcrInput())
{
    input.AddPdf("example.pdf", "password"); // Adding a PDF with password protection
    // You can select specific pages within the PDF for OCR if needed
    var Result = Ocr.Read(input);

    // Output the entire result text
    Console.WriteLine(Result.Text);
    // Output page count
    Console.WriteLine($"{Result.Pages.Count()} Pages"); // Output the number of pages
}
using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Read from a PDF file
using (var input = new OcrInput())
{
    input.AddPdf("example.pdf", "password"); // Adding a PDF with password protection
    // You can select specific pages within the PDF for OCR if needed
    var Result = Ocr.Read(input);

    // Output the entire result text
    Console.WriteLine(Result.Text);
    // Output page count
    Console.WriteLine($"{Result.Pages.Count()} Pages"); // Output the number of pages
}
Imports IronOcr

' Initialize the OCR engine
Private Ocr = New IronTesseract With {.Language = OcrLanguage.Esperanto}

' Read from a PDF file
Using input = New OcrInput()
	input.AddPdf("example.pdf", "password") ' Adding a PDF with password protection
	' You can select specific pages within the PDF for OCR if needed
	Dim Result = Ocr.Read(input)

	' Output the entire result text
	Console.WriteLine(Result.Text)
	' Output page count
	Console.WriteLine($"{Result.Pages.Count()} Pages") ' Output the number of pages
End Using
$vbLabelText   $csharpLabel

OCR por MultiPage TIFFs

OCR Reading TIFF-dosierformato inkluzive de plurpaĝaj dokumentoj. TIFF ankaŭ povas esti konvertita rekte en PDF-dosieron kun serĉebla teksto.

using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Load and read multiple frames within a TIFF file
using (var Input = new OcrInput())
{
    Input.AddMultiFrameTiff("multi-frame.tiff");
    var Result = Ocr.Read(Input);
    // Output the extracted text
    Console.WriteLine(Result.Text);
}
using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Load and read multiple frames within a TIFF file
using (var Input = new OcrInput())
{
    Input.AddMultiFrameTiff("multi-frame.tiff");
    var Result = Ocr.Read(Input);
    // Output the extracted text
    Console.WriteLine(Result.Text);
}
Imports IronOcr

' Initialize the OCR engine
Private Ocr = New IronTesseract With {.Language = OcrLanguage.Esperanto}

' Load and read multiple frames within a TIFF file
Using Input = New OcrInput()
	Input.AddMultiFrameTiff("multi-frame.tiff")
	Dim Result = Ocr.Read(Input)
	' Output the extracted text
	Console.WriteLine(Result.Text)
End Using
$vbLabelText   $csharpLabel

Strekokodoj kaj QR

Unika trajto de IronOCR estas, ke ĝi povas legi strekokodojn kaj QR-kodojn de dokumentoj dum ĝi serĉas tekston. La OcrResult.OcrBarcode Klaso donas al la programisto detalajn informojn pri ĉiu skanita strekokodo.

using IronOcr;

// Initialize the OCR engine with barcode reading enabled
var Ocr = new IronTesseract
{
    Configuration = { ReadBarCodes = true }
};

// Add an image containing a barcode or QR code
using (var input = new OcrInput())
{
    input.AddImage("img/Barcode.png");
    var Result = Ocr.Read(input);

    // Iterate and print each detected barcode value
    foreach (var Barcode in Result.Barcodes)
    {
        Console.WriteLine(Barcode.Value);
        // Other associated barcode details can also be displayed
    }
}
using IronOcr;

// Initialize the OCR engine with barcode reading enabled
var Ocr = new IronTesseract
{
    Configuration = { ReadBarCodes = true }
};

// Add an image containing a barcode or QR code
using (var input = new OcrInput())
{
    input.AddImage("img/Barcode.png");
    var Result = Ocr.Read(input);

    // Iterate and print each detected barcode value
    foreach (var Barcode in Result.Barcodes)
    {
        Console.WriteLine(Barcode.Value);
        // Other associated barcode details can also be displayed
    }
}
Imports IronOcr

' Initialize the OCR engine with barcode reading enabled
Private Ocr = New IronTesseract With {
	.Configuration = { ReadBarCodes = True }
}

' Add an image containing a barcode or QR code
Using input = New OcrInput()
	input.AddImage("img/Barcode.png")
	Dim Result = Ocr.Read(input)

	' Iterate and print each detected barcode value
	For Each Barcode In Result.Barcodes
		Console.WriteLine(Barcode.Value)
		' Other associated barcode details can also be displayed
	Next Barcode
End Using
$vbLabelText   $csharpLabel

OCR pri Specifaj Areoj de Bildoj

Ĉiuj legaj kaj skanaj metodoj de IronOCR donas la eblon precizigi precize el kiu parto de paĝo aŭ paĝoj ni deziras legi tekston. Ĉi tio estas tre utila kiam ni rigardas normigitajn formojn kaj povas ŝpari tre multe da tempo kaj plibonigi efikecon.

Por uzi rikoltajn regionojn, ni devos aldoni sisteman referencon al System.Drawing por ke ni povu uzi la objekton System.Drawing.Rectangle.

using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Specify and use OCR on a certain content area within an image
using (var Input = new OcrInput())
{
    var ContentArea = new System.Drawing.Rectangle
    {
        X = 215,
        Y = 1250,
        Height = 280,
        Width = 1335
    };

    Input.Add("document.png", ContentArea); // Provide the image with the area to read

    var Result = Ocr.Read(Input);
    // Output the extracted text
    Console.WriteLine(Result.Text);
}
using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Specify and use OCR on a certain content area within an image
using (var Input = new OcrInput())
{
    var ContentArea = new System.Drawing.Rectangle
    {
        X = 215,
        Y = 1250,
        Height = 280,
        Width = 1335
    };

    Input.Add("document.png", ContentArea); // Provide the image with the area to read

    var Result = Ocr.Read(Input);
    // Output the extracted text
    Console.WriteLine(Result.Text);
}
Imports IronOcr

' Initialize the OCR engine
Private Ocr = New IronTesseract With {.Language = OcrLanguage.Esperanto}

' Specify and use OCR on a certain content area within an image
Using Input = New OcrInput()
	Dim ContentArea = New System.Drawing.Rectangle With {
		.X = 215,
		.Y = 1250,
		.Height = 280,
		.Width = 1335
	}

	Input.Add("document.png", ContentArea) ' Provide the image with the area to read

	Dim Result = Ocr.Read(Input)
	' Output the extracted text
	Console.WriteLine(Result.Text)
End Using
$vbLabelText   $csharpLabel

OCR por Malkvalitaj Skanadoj

La Fero OCR OcrInput klaso povas ripari skanaĵojn, kiujn normala Tesseract ne povas legi.

using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Enhance and read a low-quality image
using (var Input = new OcrInput(@"img\Potter.LowQuality.tiff"))
{
    Input.DeNoise(); // Repair digital noise
    Input.Deskew();  // Repair rotation and perspective issues
    var Result = Ocr.Read(Input);
    // Output the recovered text
    Console.WriteLine(Result.Text);
}
using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Enhance and read a low-quality image
using (var Input = new OcrInput(@"img\Potter.LowQuality.tiff"))
{
    Input.DeNoise(); // Repair digital noise
    Input.Deskew();  // Repair rotation and perspective issues
    var Result = Ocr.Read(Input);
    // Output the recovered text
    Console.WriteLine(Result.Text);
}
Imports IronOcr

' Initialize the OCR engine
Private Ocr = New IronTesseract With {.Language = OcrLanguage.Esperanto}

' Enhance and read a low-quality image
Using Input = New OcrInput("img\Potter.LowQuality.tiff")
	Input.DeNoise() ' Repair digital noise
	Input.Deskew() ' Repair rotation and perspective issues
	Dim Result = Ocr.Read(Input)
	' Output the recovered text
	Console.WriteLine(Result.Text)
End Using
$vbLabelText   $csharpLabel

Eksportu rezultojn de OCR kiel Serĉebla PDF

Bildo al PDF kun kopieblaj tekstaj ĉenoj. Povas esti indeksita de serĉiloj kaj datumbazoj.

using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Create a searchable PDF from multiple images
using (var Input = new OcrInput())
{
    Input.Title = "Quarterly Report";
    Input.AddImage("image1.jpeg");
    Input.AddImage("image2.png");
    Input.AddImage("image3.gif");

    var Result = Ocr.Read(Input);
    Result.SaveAsSearchablePdf("searchable.pdf"); // Save the OCR'd content as a searchable PDF
}
using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Create a searchable PDF from multiple images
using (var Input = new OcrInput())
{
    Input.Title = "Quarterly Report";
    Input.AddImage("image1.jpeg");
    Input.AddImage("image2.png");
    Input.AddImage("image3.gif");

    var Result = Ocr.Read(Input);
    Result.SaveAsSearchablePdf("searchable.pdf"); // Save the OCR'd content as a searchable PDF
}
Imports IronOcr

' Initialize the OCR engine
Private Ocr = New IronTesseract With {.Language = OcrLanguage.Esperanto}

' Create a searchable PDF from multiple images
Using Input = New OcrInput()
	Input.Title = "Quarterly Report"
	Input.AddImage("image1.jpeg")
	Input.AddImage("image2.png")
	Input.AddImage("image3.gif")

	Dim Result = Ocr.Read(Input)
	Result.SaveAsSearchablePdf("searchable.pdf") ' Save the OCR'd content as a searchable PDF
End Using
$vbLabelText   $csharpLabel

TIFF al serĉebla PDF-Konverto

Konvertu TIFF-dokumenton (aŭ iun ajn grupon de bilddosieroj) rekte al serĉebla PDF, kiun eblas indeksigi per intrareto, retejo kaj gugla serĉiloj.

using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Convert multi-frame TIFF to a searchable PDF
using (var Input = new OcrInput())
{
    Input.AddMultiFrameTiff("example.tiff");
    var Result = Ocr.Read(Input);
    Result.SaveAsSearchablePdf("searchable.pdf"); // Export as a searchable PDF
}
using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Convert multi-frame TIFF to a searchable PDF
using (var Input = new OcrInput())
{
    Input.AddMultiFrameTiff("example.tiff");
    var Result = Ocr.Read(Input);
    Result.SaveAsSearchablePdf("searchable.pdf"); // Export as a searchable PDF
}
Imports IronOcr

' Initialize the OCR engine
Private Ocr = New IronTesseract With {.Language = OcrLanguage.Esperanto}

' Convert multi-frame TIFF to a searchable PDF
Using Input = New OcrInput()
	Input.AddMultiFrameTiff("example.tiff")
	Dim Result = Ocr.Read(Input)
	Result.SaveAsSearchablePdf("searchable.pdf") ' Export as a searchable PDF
End Using
$vbLabelText   $csharpLabel

Eksportu rezultojn de OCR kiel HTML

OCR-Bildo al XHTML-konvertiĝo.

using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Convert OCR results to HTML format
using (var Input = new OcrInput())
{
    Input.Title = "Html Title";
    Input.AddImage("image1.jpeg");

    var Result = Ocr.Read(Input);
    Result.SaveAsHocrFile("results.html"); // Save the OCR'd content as an HTML file
}
using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Convert OCR results to HTML format
using (var Input = new OcrInput())
{
    Input.Title = "Html Title";
    Input.AddImage("image1.jpeg");

    var Result = Ocr.Read(Input);
    Result.SaveAsHocrFile("results.html"); // Save the OCR'd content as an HTML file
}
Imports IronOcr

' Initialize the OCR engine
Private Ocr = New IronTesseract With {.Language = OcrLanguage.Esperanto}

' Convert OCR results to HTML format
Using Input = New OcrInput()
	Input.Title = "Html Title"
	Input.AddImage("image1.jpeg")

	Dim Result = Ocr.Read(Input)
	Result.SaveAsHocrFile("results.html") ' Save the OCR'd content as an HTML file
End Using
$vbLabelText   $csharpLabel

Filtriloj pri plibonigo de OCR

IronOCR provizas unikajn filtrilojn por OcrInput objektoj por plibonigi OCR-rendimenton.

Bilda Pliboniga Koda Ekzemplo

Faris OCR-enirajn bildojn pli altkvalitaj por produkti pli bonajn kaj pli rapidajn OCR-rezultojn.

using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Improve image quality before OCR
using (var Input = new OcrInput(@"LowQuality.jpeg"))
{
    Input.DeNoise(); // Repair digital noise
    Input.Deskew();  // Correct image skew
    var Result = Ocr.Read(Input);
    // Output the improved text recognition
    Console.WriteLine(Result.Text);
}
using IronOcr;

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto // Specify the language to use
};

// Improve image quality before OCR
using (var Input = new OcrInput(@"LowQuality.jpeg"))
{
    Input.DeNoise(); // Repair digital noise
    Input.Deskew();  // Correct image skew
    var Result = Ocr.Read(Input);
    // Output the improved text recognition
    Console.WriteLine(Result.Text);
}
Imports IronOcr

' Initialize the OCR engine
Private Ocr = New IronTesseract With {.Language = OcrLanguage.Esperanto}

' Improve image quality before OCR
Using Input = New OcrInput("LowQuality.jpeg")
	Input.DeNoise() ' Repair digital noise
	Input.Deskew() ' Correct image skew
	Dim Result = Ocr.Read(Input)
	' Output the improved text recognition
	Console.WriteLine(Result.Text)
End Using
$vbLabelText   $csharpLabel

Listo de OCR-Bildaj Filtriloj

Eniraj filtriloj por plibonigi OCR-rendimenton, kiuj estas enkonstruitaj en IronOCR, inkluzivas:

  • OcrInput.Rotate(double degrees) - Rotacias bildojn per fonodo. Por kontraŭhorloĝe, uzu negativajn nombrojn.
  • OcrInput.Binarize() - Ĉi tiu bilda filtrilo igas ĉiun pikselon nigra aŭ blanka sen meza tereno. Povas plibonigi OCR-rendimentojn en kazoj de tre malalta kontrasto de teksto al fono.
  • OcrInput.ToGrayScale() - Ĉi tiu bilda filtrilo transformas ĉiun pikselon en nuancon de grizskalo. Neŝajne plibonigos OCR-precizecon, sed eble plibonigos rapidecon.
  • OcrInput.Contrast() - Aŭtomate pliigas kontraston. Ĉi tiu filtrilo ofte plibonigas OCR-rapidecon kaj precizecon en malaltaj kontrastaj skanadoj.
  • OcrInput.DeNoise() - Forigas ciferecan bruon. Ĉi tiu filtrilo devas esti uzata nur tie, kie oni atendas bruon.
  • OcrInput.Invert() - Inversigas ĉiun koloron. Ekz. Blanko fariĝas nigra: nigro fariĝas blanka.
  • OcrInput.Dilate() - Altnivela Morfologio. Dilatado aldonas pikselojn al la limoj de objektoj en bildo. Malo de Erode.
  • OcrInput.Erode() - Altnivela Morfologio. Erozio forigas pikselojn sur objektolimoj Malkontenta de Dilate.
  • OcrInput.Deskew() - Rotacias bildon do ĝi estas ĝusta supren kaj ortogonala. Ĉi tio estas tre utila por OCR ĉar Tesseract-toleremo por distordaj skanadoj povas esti tiel malalta kiel 5 gradoj.
  • OcrInput.DeepCleanBackgroundNoise() - Forta foriga bruo. Uzu ĉi tiun filtrilon nur se ekstrema dokumenta fona bruo estas konata, ĉar ĉi tiu filtrilo ankaŭ riskos redukti OCR-precizecon de puraj dokumentoj, kaj tre kostas CPU.
  • OcrInput.EnhanceResolution - Plibonigas la distingivon de malaltkvalitaj bildoj. Ĉi tiu filtrilo ne ofte bezonas, ĉar OcrInput.MinimumDPI kaj OcrInput.TargetDPI aŭtomate kaptos kaj solvos enirojn de malalta distingivo.

PuraFonaBruo. Ĉi tio estas agordo iom konsumanta tempon; tamen ĝi permesas al la biblioteko aŭtomate purigi ciferecan bruon, paperajn ĉifojn kaj aliajn neperfektaĵojn ene de cifereca bildo, kiu alie igus ĝin malkapabla esti legata de aliaj OCR-bibliotekoj.

EnhanceContrast estas agordo, kiu igas IronOCR aŭtomate pliigi la kontraston de teksto kontraŭ la fono de bildo, pliigante la precizecon de OCR kaj ĝenerale pliigante rendimenton kaj la rapidon de OCR.

EnhanceResolution estas agordo, kiu aŭtomate detektas bildojn de malalta distingivo (malpli ol 275 dpi) kaj aŭtomate altigas la bildon kaj poste akrigas la tutan tekston, por ke ĝi estu perfekte legebla per OCR-biblioteko. Kvankam ĉi tiu operacio per si mem konsumas tempon, ĝi ĝenerale reduktas la ĝeneralan tempon por OCR-operacio sur bildo.

Language IronOCR subtenas 126 internaciajn lingvopakaĵojn, kaj la lingva agordo povas esti uzata por elekti unu aŭ plurajn multoblajn lingvojn petotajn por OCR-operacio.

Strategy IronOCR subtenas du strategiojn. Ni eble elektos aŭ serĉi rapidan kaj malpli precizan skanadon de dokumento, aŭ uzi progresintan strategion, kiu uzas iujn modelojn de artefarita inteligenteco por aŭtomate plibonigi la precizecon de OCR-teksto, rigardante la statistikan rilaton de vortoj unu al la alia en frazo.

ColorSpace estas agordo per kiu ni povas elekti OCR en grizskala aŭ kolora. Ĝenerale griza skalo estas la plej bona elekto. Tamen, foje kiam estas tekstoj aŭ fonoj de simila nuanco sed tre malsama koloro, plenkolora kolorspaco donos pli bonajn rezultojn.

DetectWhiteTextOnDarkBackgrounds. Ĝenerale ĉiuj bibliotekoj OCR atendas vidi nigran tekston sur blankaj fonoj. Ĉi tiu agordo permesas al IronOCR aŭtomate detekti negativojn, aŭ malhelajn paĝojn kun blanka teksto, kaj legi ilin.

EnigaBildaTipo. Ĉi tiu agordo permesas al la programisto gvidi la bibliotekon OCR pri tio, ĉu ĝi rigardas plenan dokumenton aŭ fragmenton, kiel ekzemple ekrankopio.

RotateAndStraighten estas altnivela agordo, kiu permesas al IronOCR la unikan kapablon legi dokumentojn, kiuj ne nur turniĝas, sed eble enhavas perspektivon, kiel fotoj de tekstaj dokumentoj.

ReadBarcodes estas utila funkcio, kiu permesas al IronOCR aŭtomate legi strekokodojn kaj QR-kodojn sur paĝoj, ĉar ĝi ankaŭ legas tekston, sen aldoni grandan aldonan tempon.

Ko lora Profundo. Ĉi tiu agordo determinas kiom da bitoj por pikselo la OCR-biblioteko uzos por determini la profundon de koloro. Pli alta kolora profundo povas pliigi OCR-kvaliton, sed ankaŭ pliigos la tempon necesan por finiĝi la OCR-operacio.

126 Lingvaj Pakoj

IronOCR subtenas 126 internaciajn lingvojn per lingvopakaĵoj distribuataj kiel DLL-oj, elŝuteblaj de ĉi tiu retejo aŭ ankaŭ de la NuGet-Pakaĵa Administrilo.

Lingvoj inkluzivas germanan, francan, anglan, ĉinan, japanan kaj multajn aliajn. Fakaj lingvopakoj ekzistas por pasportaj MRZ, MICR-ĉekoj, Financaj Datumoj, numerplatoj kaj multaj pli. Vi ankaŭ povas uzi ajnan dosieron ".traineddata" de tesseract - inkluzive de vi mem kreitaj.

Lingva Ekzemplo

Uzante Aliajn OCR-lingvojn.

using IronOcr;

// PM> Install IronOcr.Languages.Arabic

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Arabic // Specify the language to use
};

// Perform OCR on an Arabic image
using (var input = new OcrInput())
{
    input.AddImage("img/arabic.gif"); // add image containing Arabic text

    // Apply image filters if necessary
    // Even if the input is low quality, IronTesseract can read what conventional Tesseract cannot.
    var Result = Ocr.Read(input);

    // Console cannot easily display Arabic on Windows 
    // Instead of printing, we save the text to a file.
    Result.SaveAsTextFile("arabic.txt");
}
using IronOcr;

// PM> Install IronOcr.Languages.Arabic

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Arabic // Specify the language to use
};

// Perform OCR on an Arabic image
using (var input = new OcrInput())
{
    input.AddImage("img/arabic.gif"); // add image containing Arabic text

    // Apply image filters if necessary
    // Even if the input is low quality, IronTesseract can read what conventional Tesseract cannot.
    var Result = Ocr.Read(input);

    // Console cannot easily display Arabic on Windows 
    // Instead of printing, we save the text to a file.
    Result.SaveAsTextFile("arabic.txt");
}
Imports IronOcr

' PM> Install IronOcr.Languages.Arabic

' Initialize the OCR engine
Private Ocr = New IronTesseract With {.Language = OcrLanguage.Arabic}

' Perform OCR on an Arabic image
Using input = New OcrInput()
	input.AddImage("img/arabic.gif") ' add image containing Arabic text

	' Apply image filters if necessary
	' Even if the input is low quality, IronTesseract can read what conventional Tesseract cannot.
	Dim Result = Ocr.Read(input)

	' Console cannot easily display Arabic on Windows 
	' Instead of printing, we save the text to a file.
	Result.SaveAsTextFile("arabic.txt")
End Using
$vbLabelText   $csharpLabel

Plurlingva Ekzemplo

Ankaŭ eblas OCR uzi plurajn lingvojn samtempe. Ĉi tio vere povas helpi akiri anglalingvajn metadatenojn kaj URL-ojn en Unikodaj dokumentoj.

using IronOcr;

// PM> Install IronOcr.Languages.ChineseSimplified

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.ChineseSimplified // Primary language
};
Ocr.AddSecondaryLanguage(OcrLanguage.Esperanto); // Add secondary language

// OCR on a multi-language document
using (var input = new OcrInput())
{
    input.Add("multi-language.pdf");
    var Result = Ocr.Read(input);
    // Save the resulting text to a file
    Result.SaveAsTextFile("results.txt");
}
using IronOcr;

// PM> Install IronOcr.Languages.ChineseSimplified

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.ChineseSimplified // Primary language
};
Ocr.AddSecondaryLanguage(OcrLanguage.Esperanto); // Add secondary language

// OCR on a multi-language document
using (var input = new OcrInput())
{
    input.Add("multi-language.pdf");
    var Result = Ocr.Read(input);
    // Save the resulting text to a file
    Result.SaveAsTextFile("results.txt");
}
Imports IronOcr

' PM> Install IronOcr.Languages.ChineseSimplified

' Initialize the OCR engine
Private Ocr = New IronTesseract With {.Language = OcrLanguage.ChineseSimplified}
Ocr.AddSecondaryLanguage(OcrLanguage.Esperanto) ' Add secondary language

' OCR on a multi-language document
Using input = New OcrInput()
	input.Add("multi-language.pdf")
	Dim Result = Ocr.Read(input)
	' Save the resulting text to a file
	Result.SaveAsTextFile("results.txt")
End Using
$vbLabelText   $csharpLabel

Detalaj OCR-Rezultaj Celoj

Fera OCR redonas OCR-rezultobjekton por ĉiu OCR-operacio. Ĝenerale programistoj nur uzas la tekstan econ de ĉi tiu objekto por skani la tekston de la bildo. Tamen, la OCR-rezultoj DOM estas multe pli progresintaj ol ĉi tio.

using IronOcr;
using System.Drawing; // Required for rectangle specification

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto, // Specify the language to use
    Configuration =
    {
        EngineMode = TesseractEngineMode.TesseractAndLstm, // Use both Tesseract and LSTM for better results
        ReadBarCodes = true // Enable barcode reading
    }
};

// Read and analyze a sample TIFF image
using (var Input = new OcrInput(@"images\sample.tiff"))
{
    OcrResult Result = Ocr.Read(Input);

    // Extract detailed information from the OCR result
    var Pages = Result.Pages;
    var Words = Pages[0].Words;
    var Barcodes = Result.Barcodes;

    // Detailed exploration is possible with:
    // - Pages, Blocks, Paragraphs, Lines, Words, Characters
    // - Image exports, Font coordinates, Statistical data
}
using IronOcr;
using System.Drawing; // Required for rectangle specification

// Initialize the OCR engine
var Ocr = new IronTesseract
{
    Language = OcrLanguage.Esperanto, // Specify the language to use
    Configuration =
    {
        EngineMode = TesseractEngineMode.TesseractAndLstm, // Use both Tesseract and LSTM for better results
        ReadBarCodes = true // Enable barcode reading
    }
};

// Read and analyze a sample TIFF image
using (var Input = new OcrInput(@"images\sample.tiff"))
{
    OcrResult Result = Ocr.Read(Input);

    // Extract detailed information from the OCR result
    var Pages = Result.Pages;
    var Words = Pages[0].Words;
    var Barcodes = Result.Barcodes;

    // Detailed exploration is possible with:
    // - Pages, Blocks, Paragraphs, Lines, Words, Characters
    // - Image exports, Font coordinates, Statistical data
}
Imports IronOcr
Imports System.Drawing ' Required for rectangle specification

' Initialize the OCR engine
Private Ocr = New IronTesseract With {
	.Language = OcrLanguage.Esperanto,
	.Configuration = {
		EngineMode = TesseractEngineMode.TesseractAndLstm,
		ReadBarCodes = True
	}
}

' Read and analyze a sample TIFF image
Using Input = New OcrInput("images\sample.tiff")
	Dim Result As OcrResult = Ocr.Read(Input)

	' Extract detailed information from the OCR result
	Dim Pages = Result.Pages
	Dim Words = Pages(0).Words
	Dim Barcodes = Result.Barcodes

	' Detailed exploration is possible with:
	' - Pages, Blocks, Paragraphs, Lines, Words, Characters
	' - Image exports, Font coordinates, Statistical data
End Using
$vbLabelText   $csharpLabel

Agado

IronOCR funkcias tute sen neceso agordi aŭ forte modifi enigajn bildojn.

Rapido estas Flamanta: IronOcr.2020+ estas ĝis 10 fojoj pli rapida kaj faras pli ol 250% malpli da eraroj ol antaŭaj versioj.

Lernu pli

Por lerni pli pri OCR en C#, VB, F# aŭ iu ajn alia .NET-lingvo, bonvolu legi niajn komunumajn lernilojn, kiuj donas realajn ekzemplojn pri kiel Fera OCR povas esti uzata kaj povas montri la nuancojn de kiel eltiri la plej bonan el ĉi tiu biblioteko.

Plena objektoreferenco por .NET-programistoj ankaŭ haveblas.