using IronOcr;using System;using static IronOcr.OcrResult;// Instantiate IronTesseractIronTesseract ocrTesseract = new IronTesseract();// Add imageusing var imageInput = new OcrImageInput("sampleText.png");// Perform OCROcrResult ocrResult = ocrTesseract.Read(imageInput);// Retrieve list of detected paragraphsParagraph[] paragraphs = ocrResult.Paragraphs;// Loop through each paragraph in the arrayConsole.WriteLine("--- All Detected Paragraphs ---");foreach (Paragraph paragraph in paragraphs){ // Print the text of the current paragraphConsole.WriteLine(paragraph.Text); // Add a blank line for better separation (optional)Console.WriteLine();}
using IronOcr;
using System;
using static IronOcr.OcrResult;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Add image
using var imageInput = new OcrImageInput("sampleText.png");
// Perform OCR
OcrResult ocrResult = ocrTesseract.Read(imageInput);
// Retrieve list of detected paragraphs
Paragraph[] paragraphs = ocrResult.Paragraphs;
// Loop through each paragraph in the array
Console.WriteLine("--- All Detected Paragraphs ---");
foreach (Paragraph paragraph in paragraphs)
{
// Print the text of the current paragraph
Console.WriteLine(paragraph.Text);
// Add a blank line for better separation (optional)
Console.WriteLine();
}
ImportsIronOcrImportsSystemImportsIronOcr.OcrResult' Instantiate IronTesseractDim ocrTesseract As New IronTesseract()' Add imageUsing imageInput As New OcrImageInput("sampleText.png") ' Perform OCR Dim ocrResult AsOcrResult = ocrTesseract.Read(imageInput) ' Retrieve list of detected paragraphs Dim paragraphs AsParagraph() = ocrResult.Paragraphs ' Loop through each paragraph in the arrayConsole.WriteLine("--- All Detected Paragraphs ---") For Each paragraph AsParagraphIn paragraphs ' Print the text of the current paragraphConsole.WriteLine(paragraph.Text) ' Add a blank line for better separation (optional)Console.WriteLine() NextEndUsing
Imports IronOcr
Imports System
Imports IronOcr.OcrResult
' Instantiate IronTesseract
Dim ocrTesseract As New IronTesseract()
' Add image
Using imageInput As New OcrImageInput("sampleText.png")
' Perform OCR
Dim ocrResult As OcrResult = ocrTesseract.Read(imageInput)
' Retrieve list of detected paragraphs
Dim paragraphs As Paragraph() = ocrResult.Paragraphs
' Loop through each paragraph in the array
Console.WriteLine("--- All Detected Paragraphs ---")
For Each paragraph As Paragraph In paragraphs
' Print the text of the current paragraph
Console.WriteLine(paragraph.Text)
' Add a blank line for better separation (optional)
Console.WriteLine()
Next
End Using
using IronOcr;using System;using static IronOcr.OcrResult;// Instantiate IronTesseractIronTesseract ocrTesseract = new IronTesseract();// Add imageusing var imageInput = new OcrImageInput("sampleText.png");// Perform OCROcrResult ocrResult = ocrTesseract.Read(imageInput);// Retrieve list of detected paragraphsParagraph[] paragraphs = ocrResult.Paragraphs;Console.WriteLine("--- All Detected Coordinates of Paragraphs ---");// Use a 'for' loop to get an index for each paragraphfor (int i = 0; i < paragraphs.Length; i++){ // Get the current paragraph Paragraph paragraph = paragraphs[i]; // Print the paragraph number, text, and its locationConsole.WriteLine($"X: {paragraph.X}"); // X-coordinate (left edge)Console.WriteLine($"Y: {paragraph.Y}"); // Y-coordinate (top edge) // Add a blank line for better separationConsole.WriteLine();}
using IronOcr;
using System;
using static IronOcr.OcrResult;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Add image
using var imageInput = new OcrImageInput("sampleText.png");
// Perform OCR
OcrResult ocrResult = ocrTesseract.Read(imageInput);
// Retrieve list of detected paragraphs
Paragraph[] paragraphs = ocrResult.Paragraphs;
Console.WriteLine("--- All Detected Coordinates of Paragraphs ---");
// Use a 'for' loop to get an index for each paragraph
for (int i = 0; i < paragraphs.Length; i++)
{
// Get the current paragraph
Paragraph paragraph = paragraphs[i];
// Print the paragraph number, text, and its location
Console.WriteLine($"X: {paragraph.X}"); // X-coordinate (left edge)
Console.WriteLine($"Y: {paragraph.Y}"); // Y-coordinate (top edge)
// Add a blank line for better separation
Console.WriteLine();
}
ImportsIronOcrImportsSystemImportsIronOcr.OcrResult' Instantiate IronTesseractDim ocrTesseract As New IronTesseract()' Add imageUsing imageInput As New OcrImageInput("sampleText.png") ' Perform OCR Dim ocrResult AsOcrResult = ocrTesseract.Read(imageInput) ' Retrieve list of detected paragraphs Dim paragraphs AsParagraph() = ocrResult.ParagraphsConsole.WriteLine("--- All Detected Coordinates of Paragraphs ---") ' Use a 'for' loop to get an index for each paragraph For i AsInteger = 0 To paragraphs.Length - 1 ' Get the current paragraph Dim paragraph AsParagraph = paragraphs(i) ' Print the paragraph number, text, and its locationConsole.WriteLine($"X: {paragraph.X}") ' X-coordinate (left edge)Console.WriteLine($"Y: {paragraph.Y}") ' Y-coordinate (top edge) ' Add a blank line for better separationConsole.WriteLine() NextEndUsing
Imports IronOcr
Imports System
Imports IronOcr.OcrResult
' Instantiate IronTesseract
Dim ocrTesseract As New IronTesseract()
' Add image
Using imageInput As New OcrImageInput("sampleText.png")
' Perform OCR
Dim ocrResult As OcrResult = ocrTesseract.Read(imageInput)
' Retrieve list of detected paragraphs
Dim paragraphs As Paragraph() = ocrResult.Paragraphs
Console.WriteLine("--- All Detected Coordinates of Paragraphs ---")
' Use a 'for' loop to get an index for each paragraph
For i As Integer = 0 To paragraphs.Length - 1
' Get the current paragraph
Dim paragraph As Paragraph = paragraphs(i)
' Print the paragraph number, text, and its location
Console.WriteLine($"X: {paragraph.X}") ' X-coordinate (left edge)
Console.WriteLine($"Y: {paragraph.Y}") ' Y-coordinate (top edge)
' Add a blank line for better separation
Console.WriteLine()
Next
End Using
using IronOcr;using System;using static IronOcr.OcrResult;// Instantiate IronTesseractIronTesseract ocrTesseract = new IronTesseract();// Enable barcodes detectionocrTesseract.Configuration.ReadBarCodes = true;// Add imageusing OcrInput ocrInput = new OcrInput();ocrInput.LoadPdf("sample.pdf");// Perform OCROcrResult ocrResult = ocrTesseract.Read(ocrInput);// Output information to consoleforeach(var barcode in ocrResult.Barcodes){Console.WriteLine("Format = " + barcode.Format);Console.WriteLine("Value = " + barcode.Value);Console.WriteLine("X = " + barcode.X);Console.WriteLine("Y = " + barcode.Y);}Console.WriteLine(ocrResult.Text);
using IronOcr;
using System;
using static IronOcr.OcrResult;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Enable barcodes detection
ocrTesseract.Configuration.ReadBarCodes = true;
// Add image
using OcrInput ocrInput = new OcrInput();
ocrInput.LoadPdf("sample.pdf");
// Perform OCR
OcrResult ocrResult = ocrTesseract.Read(ocrInput);
// Output information to console
foreach(var barcode in ocrResult.Barcodes)
{
Console.WriteLine("Format = " + barcode.Format);
Console.WriteLine("Value = " + barcode.Value);
Console.WriteLine("X = " + barcode.X);
Console.WriteLine("Y = " + barcode.Y);
}
Console.WriteLine(ocrResult.Text);
ImportsIronOcrImportsSystemImportsIronOcr.OcrResult' Instantiate IronTesseractPrivate ocrTesseract As New IronTesseract()' Enable barcodes detectionocrTesseract.Configuration.ReadBarCodes = True' Add imageUsing ocrInput As New OcrInput() ocrInput.LoadPdf("sample.pdf") ' Perform OCR Dim ocrResult AsOcrResult = ocrTesseract.Read(ocrInput) ' Output information to console For Each barcode In ocrResult.BarcodesConsole.WriteLine("Format = " & barcode.Format)Console.WriteLine("Value = " & barcode.Value)Console.WriteLine("X = " & barcode.X)Console.WriteLine("Y = " & barcode.Y) Next barcodeConsole.WriteLine(ocrResult.Text)EndUsing
Imports IronOcr
Imports System
Imports IronOcr.OcrResult
' Instantiate IronTesseract
Private ocrTesseract As New IronTesseract()
' Enable barcodes detection
ocrTesseract.Configuration.ReadBarCodes = True
' Add image
Using ocrInput As New OcrInput()
ocrInput.LoadPdf("sample.pdf")
' Perform OCR
Dim ocrResult As OcrResult = ocrTesseract.Read(ocrInput)
' Output information to console
For Each barcode In ocrResult.Barcodes
Console.WriteLine("Format = " & barcode.Format)
Console.WriteLine("Value = " & barcode.Value)
Console.WriteLine("X = " & barcode.X)
Console.WriteLine("Y = " & barcode.Y)
Next barcode
Console.WriteLine(ocrResult.Text)
End Using
Yes, IronOCR can read common barcode types, including QR codes, by enabling barcode detection in the configuration. This integration allows for comprehensive processing of documents containing both text and barcodes.
How does IronOCR help with hierarchical text analysis?
IronOCR's hierarchical text structure allows developers to work at different granularity levels, such as paragraphs, lines, words, and characters, making it suitable for various applications like document structure analysis and text search functionality.
What advanced features does IronOCR offer for coordinate-based operations?
IronOCR offers OCR region targeting for focused text extraction and Computer Vision capabilities to automatically identify text regions, enhancing precision in coordinate-based applications.
What does the barcode detection output look like in IronOCR?
The barcode detection output in IronOCR includes format identification, decoded values, and precise coordinates, seamlessly integrated with text extraction for efficient processing of mixed content documents.