IRONSOFTWAREHOME
Lire une photo
using IronOcr;
using IronSoftware.Drawing;
using System;

// Instantiate OCR engine
var ocr = new IronTesseract();

using var inputPhoto = new OcrInput();
inputPhoto.LoadImageFrame("ocr.tiff", 0);

// Read photo
OcrPhotoResult result = ocr.ReadPhoto(inputPhoto);

// Index number refer to region order in the page
int number = result.TextRegions[0].PageNumber;

// Extract the text in the first region
string textinregion = result.TextRegions[0].TextInRegion;

//Extract the co-ordinates of the first text region
Rectangle region = result.TextRegions[0].Region;

var output = $"Text in First Region: {textinregion}\n"
             + $"Text Region:\n"
             + $"Starting X: {region.X}\n"
             + $"Starting Y: {region.Y}\n"
             + $"Region Width: {region.Width}\n"
             + $"Region Height: {region.Height}\n"
             + $"Result Confidence: {result.Confidence}\n\n"
             + $"Full Scnned Photo Text: {result.Text}";

Console.WriteLine(output);
Imports IronOcr
Imports IronSoftware.Drawing
Imports System

' Instantiate OCR engine
Dim ocr As New IronTesseract()

Using inputPhoto As New OcrInput()
    inputPhoto.LoadImageFrame("ocr.tiff", 0)

    ' Read photo
    Dim result As OcrPhotoResult = ocr.ReadPhoto(inputPhoto)

    ' Index number refer to region order in the page
    Dim number As Integer = result.TextRegions(0).PageNumber

    ' Extract the text in the first region
    Dim textinregion As String = result.TextRegions(0).TextInRegion

    'Extract the co-ordinates of the first text region
    Dim region As Rectangle = result.TextRegions(0).Region

    Dim output As String = $"Text in First Region: {textinregion}" & vbCrLf &
                           $"Text Region:" & vbCrLf &
                           $"Starting X: {region.X}" & vbCrLf &
                           $"Starting Y: {region.Y}" & vbCrLf &
                           $"Region Width: {region.Width}" & vbCrLf &
                           $"Region Height: {region.Height}" & vbCrLf &
                           $"Result Confidence: {result.Confidence}" & vbCrLf & vbCrLf &
                           $"Full Scnned Photo Text: {result.Text}"

    Console.WriteLine(output)
End Using
NuGet Download
PM > Install-Package IronOcr
Lire une photo

Lire une photo

Voir sur GitHub

Prêt à commencer?

Nuget Downloads 6,236,385Version :2026.9vient de sortir

Key in blue circle

Obtenez votre clé d'essai de 30 jours instantanément.

Your trial license will be sent to your email address

Aucune restriction. 100 % débloqué. Pas de carte bancaire.

bullet_checkedAucune carte de crédit ou création de compte requiseAucune restriction. 100 % débloqué. Pas de carte bancaire.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Obtenez Votre Consultation sans Engagement
Remplissez le formulaire ci-dessous ou envoyez un email à sales@ironsoftware.com
Vos informations seront toujours gardées confidentielles.
De confiance par des millions d'ingénieurs dans le monde entier
Logos des clients d'Iron Software
Obtenez votre clé d'essai 30 jours gratuitement.
Aucune carte de crédit ou création de compte requise