C# OCR Image to Text Tutorial: Convert Images to Text Without Tesseract
C# dilinde, karmaşık Tesseract yapılandırmalarından kaçınarak görüntüleri metne dönüştürmek mi istiyorsunuz? Bu kapsamlı IronOCR C# rehberi, .NET uygulamalarınızda güçlü optik karakter tanımayı sadece birkaç satır kodla nasıl uygulayacağınızı gösterir.
Hızlı Başlangıç: Tek Satırda Görüntüden Metin Çıkarın
Bu örnek, IronOCR'yi kavramanın ne kadar kolay olduğunu gösterir—sadece bir satır C# kodu ile görüntünüz metne dönüşür. OCR motorunu başlatıp, karmaşık yapılandırmalar gerektirmeden hemen metin okuma ve elde etme işlemini gösterir.
-
IronOCR aşağıdaki NuGet Paket Yöneticisi ile yükleyin
PM > Install-Package IronOcr -
Bu kod parçacığını kopyalayın ve çalıştırın.
string text = new IronTesseract().Read("image.png").Text; -
Canlı ortamınızda test için dağıtım yapın
Ücretsiz deneme ile bugün projenizde IronOCR kullanmaya başlayın
Asgari İş Akışı (5 adım)
- IronOCR'yi İndirin - görüntüden metne dönüştürme için C# OCR kütüphanesi
IronTesseractsınıfını kullanarak görüntülerden anında metin okuyun- Düşük kaliteli taramalarda OCR doğruluğunu artırmak için görüntü filtreleri uygulayın
- İndirilebilir dil paketleriyle birden fazla dili işleyin
- Sonuçları aranabilir PDF'ler olarak dışa aktarın veya metin dizgileri çıkarın
.NET Uygulamalarında Görüntülerden Metin Nasıl Okunur?
.NET uygulamalarınızda C# OCR görüntüden metne işlevselliği elde etmek için güvenilir bir OCR kütüphanesine ihtiyacınız olacak. IronOCR, harici bağımlılıklara gerek kalmadan hem doğruluğu hem de hızı en üst düzeye çıkaran IronOcr.IronTesseract sınıfını kullanan yönetilen bir çözüm sunar.
Öncelikle, IronOCR'yi Visual Studio projenize kurun. IronOCR DLL dosyasını doğrudan indirebilirsiniz veya NuGet Paket Yöneticisini kullanabilirsiniz.
Install-Package IronOcr
Google Tesseract Olmadan C# için Neden IronOCR'yi Seçmelisiniz?
C# dilinde görüntüleri metne dönüştürmeniz gerektiğinde, IronOCR geleneksel Tesseract uygulamalarına göre önemli avantajlar sunar:
- Saf .NET ortamlarında hemen çalışır
- Tesseract kurulumu veya yapılandırması gerektirmez
- En son motorları çalıştırır: Tesseract 5 (artı Tesseract 4 & 3)
- .NET Framework 4.6.2+, .NET Standard 2+, ve .NET Core 2, 3, 5, 6, 7, 8, 9 ve 10 ile uyumlu
- Vanilla Tesseract'a kıyasla doğruluğu ve hızı artırır
- Xamarin, Mono, Azure ve Docker dağıtımlarını destekler
- Karmaşık Tesseract sözlüklerini NuGet paketleri aracılığıyla yönetir
- PDF'ler, MultiFrame TIFF'ler ve tüm büyük görüntü formatlarını otomatik olarak işler
- Optimal sonuçlar için düşük kaliteli ve eğik taramaları düzeltir
IronOCR C# Öğreticisini Temel OCR için Nasıl Kullanabilirsiniz?
Bu Iron Tesseract C# örneği, IronOCR kullanarak görüntüden metin okumanın en basit yolunu gösterir. IronOcr.IronTesseract sınıfı metni çıkarır ve bir dize olarak döndürür.
// Basic C# OCR image to text conversion using IronOCR
// This example shows how to extract text from images without complex setup
using IronOcr;
using System;
try
{
// Initialize IronTesseract for OCR operations
var ocrEngine = new IronTesseract();
// Path to your image file - supports PNG, JPG, TIFF, BMP, and more
var imagePath = @"img\Screenshot.png";
// Create input and perform OCR to convert image to text
using (var input = new OcrInput(imagePath))
{
// Read text from image and get results
OcrResult result = ocrEngine.Read(input);
// Display extracted text
Console.WriteLine(result.Text);
}
}
catch (OcrException ex)
{
// Handle OCR-specific errors
Console.WriteLine($"OCR Error: {ex.Message}");
}
catch (Exception ex)
{
// Handle general errors
Console.WriteLine($"Error: {ex.Message}");
}
// Basic C# OCR image to text conversion using IronOCR
// This example shows how to extract text from images without complex setup
using IronOcr;
using System;
try
{
// Initialize IronTesseract for OCR operations
var ocrEngine = new IronTesseract();
// Path to your image file - supports PNG, JPG, TIFF, BMP, and more
var imagePath = @"img\Screenshot.png";
// Create input and perform OCR to convert image to text
using (var input = new OcrInput(imagePath))
{
// Read text from image and get results
OcrResult result = ocrEngine.Read(input);
// Display extracted text
Console.WriteLine(result.Text);
}
}
catch (OcrException ex)
{
// Handle OCR-specific errors
Console.WriteLine($"OCR Error: {ex.Message}");
}
catch (Exception ex)
{
// Handle general errors
Console.WriteLine($"Error: {ex.Message}");
}
' Basic C# OCR image to text conversion using IronOCR
' This example shows how to extract text from images without complex setup
Imports IronOcr
Imports System
Try
' Initialize IronTesseract for OCR operations
Dim ocrEngine = New IronTesseract()
' Path to your image file - supports PNG, JPG, TIFF, BMP, and more
Dim imagePath = "img\Screenshot.png"
' Create input and perform OCR to convert image to text
Using input = New OcrInput(imagePath)
' Read text from image and get results
Dim result As OcrResult = ocrEngine.Read(input)
' Display extracted text
Console.WriteLine(result.Text)
End Using
Catch ex As OcrException
' Handle OCR-specific errors
Console.WriteLine($"OCR Error: {ex.Message}")
Catch ex As Exception
' Handle general errors
Console.WriteLine($"Error: {ex.Message}")
End Try
Bu kod, net görüntülerde %100 doğruluk sağlar, metni tam olarak göründüğü şekliyle çıkarır:
IronOCR Simple Example
In this simple example we test the accuracy of our C# OCR library to read text from a PNG Image. This is a very basic test, but things will get more complicated as the tutorial continues.
The quick brown fox jumps over the lazy dog
IronTesseract sınıfı, karmaşık OCR işlemlerini dahili olarak gerçekleştirir. Metini görüntüden insan düzeyinde doğrulukla okumak için IronOCR kullanarak hizalama taraması, çözünürlüğü optimize etme ve yapay zeka kullanmayı otomatik olarak yapar.
Görünmeyen süreçlerin arka planında gerçekleşen karmaşık işleme - görüntü analizi, motor optimizasyonu ve akıllı metin tanıma - rağmen OCR süreci, insan okuma hızını karşılar ve olağanüstü doğruluk seviyelerini korur.
IronOCR'nin bir PNG görüntüsünden mükemmel doğrulukla metin çıkarma yeteneğini gösteren ekran görüntüsü
Tesseract Yapılandırması Olmadan Gelişmiş C# OCR Nasıl Uygulanır?
C#'da görüntüleri metne dönüştürürken optimum performans gerektiren üretim uygulamaları için, OcrInput ve IronTesseract sınıflarını birlikte kullanın. Bu yaklaşım, OCR işlemi üzerinde ince-granüllü kontrol sağlar.
OcrInput Sınıf Özellikleri
- Birden fazla görüntü formatını işler: JPEG, TIFF, GIF, BMP, PNG
- Tam PDF dosyalarını veya belirli sayfaları içe aktarır
- Kontrast, çözünürlük ve görüntü kalitesini otomatik olarak artırır
- Döngü, tarama gürültüsü, kaçıklık ve negatif görüntüleri düzeltir
IronTesseract Sınıf Özellikleri
- 127'den fazla önceden paketlenmiş dile erişim
- Tesseract 5, 4 ve 3 motorları dahil
- Belge tipi belirtimi (ekran görüntüsü, snippet veya tam belge)
- Entegre barkod okuma yetenekleri
- Çoklu çıktı formatları: Aranabilir PDF'ler, HOCR HTML, DOM nesneleri ve dizgeler
OcrInput ve IronTesseract ile nasıl başlanır?
Çoğu belge türüyle iyi çalışan bu IronOCR C# eğitimi için önerilen yapılandırma:
using IronOcr;
// Initialize IronTesseract for advanced OCR operations
IronTesseract ocr = new IronTesseract();
// Create input container for processing multiple images
using (OcrInput input = new OcrInput())
{
// Process specific pages from multi-page TIFF files
int[] pageIndices = new int[] { 1, 2 };
// Load TIFF frames - perfect for scanned documents
input.LoadImageFrames(@"img\Potter.tiff", pageIndices);
// Execute OCR to read text from image using IronOCR
OcrResult result = ocr.Read(input);
// Output the extracted text
Console.WriteLine(result.Text);
}
using IronOcr;
// Initialize IronTesseract for advanced OCR operations
IronTesseract ocr = new IronTesseract();
// Create input container for processing multiple images
using (OcrInput input = new OcrInput())
{
// Process specific pages from multi-page TIFF files
int[] pageIndices = new int[] { 1, 2 };
// Load TIFF frames - perfect for scanned documents
input.LoadImageFrames(@"img\Potter.tiff", pageIndices);
// Execute OCR to read text from image using IronOCR
OcrResult result = ocr.Read(input);
// Output the extracted text
Console.WriteLine(result.Text);
}
Imports IronOcr
' Initialize IronTesseract for advanced OCR operations
Private ocr As New IronTesseract()
' Create input container for processing multiple images
Using input As New OcrInput()
' Process specific pages from multi-page TIFF files
Dim pageIndices() As Integer = { 1, 2 }
' Load TIFF frames - perfect for scanned documents
input.LoadImageFrames("img\Potter.tiff", pageIndices)
' Execute OCR to read text from image using IronOCR
Dim result As OcrResult = ocr.Read(input)
' Output the extracted text
Console.WriteLine(result.Text)
End Using
Bu yapılandırma, orta kaliteli taramalar üzerinde sürekli olarak neredeyse mükemmel doğruluk elde eder. LoadImageFrames yöntemi, çok sayfalı belgeleri verimli bir şekilde işler ve bu da onu toplu işleme senaryoları için ideal hale getirir.
IronOCR'un çok sayfalı metin çıkarma yeteneklerini gösteren TIFF örnek belgesi
Taralı belgelerden görüntülerden ve barkodlardan metin okuma yeteneği, IronOCR'nin karmaşık OCR görevlerini nasıl basitleştirdiğini gösterir. Kütüphane, çok sayfalı TIFF'leri ve PDF metin çıkarmayı kesintisiz bir şekilde işleyen gerçek dünya belgeleriyle mükemmeldir.
IronOCR, Düşük Kaliteli Taramaları Nasıl Ele Alır?
Demonstrating IronOCR's ability to accurately process low-resolution, noisy documents using image filters
IronOCR, C# OCR kütüphanelerine kıyasla düşük kaliteli taramaları daha iyi işler. Özellikle mükemmel test görüntüleri yerine gerçek dünya senaryoları için tasarlanmıştır.
// Advanced Iron Tesseract C# example for low-quality images
using IronOcr;
using System;
var ocr = new IronTesseract();
try
{
using (var input = new OcrInput())
{
// Load specific pages from poor-quality TIFF
var pageIndices = new int[] { 0, 1 };
input.LoadImageFrames(@"img\Potter.LowQuality.tiff", pageIndices);
// Apply deskew filter to correct rotation and perspective
input.Deskew(); // Critical for improving accuracy on skewed scans
// Perform OCR with enhanced preprocessing
OcrResult result = ocr.Read(input);
// Display results
Console.WriteLine("Recognized Text:");
Console.WriteLine(result.Text);
}
}
catch (Exception ex)
{
Console.WriteLine($"Error during OCR: {ex.Message}");
}
// Advanced Iron Tesseract C# example for low-quality images
using IronOcr;
using System;
var ocr = new IronTesseract();
try
{
using (var input = new OcrInput())
{
// Load specific pages from poor-quality TIFF
var pageIndices = new int[] { 0, 1 };
input.LoadImageFrames(@"img\Potter.LowQuality.tiff", pageIndices);
// Apply deskew filter to correct rotation and perspective
input.Deskew(); // Critical for improving accuracy on skewed scans
// Perform OCR with enhanced preprocessing
OcrResult result = ocr.Read(input);
// Display results
Console.WriteLine("Recognized Text:");
Console.WriteLine(result.Text);
}
}
catch (Exception ex)
{
Console.WriteLine($"Error during OCR: {ex.Message}");
}
' Advanced Iron Tesseract C# example for low-quality images
Imports IronOcr
Imports System
Private ocr = New IronTesseract()
Try
Using input = New OcrInput()
' Load specific pages from poor-quality TIFF
Dim pageIndices = New Integer() { 0, 1 }
input.LoadImageFrames("img\Potter.LowQuality.tiff", pageIndices)
' Apply deskew filter to correct rotation and perspective
input.Deskew() ' Critical for improving accuracy on skewed scans
' Perform OCR with enhanced preprocessing
Dim result As OcrResult = ocr.Read(input)
' Display results
Console.WriteLine("Recognized Text:")
Console.WriteLine(result.Text)
End Using
Catch ex As Exception
Console.WriteLine($"Error during OCR: {ex.Message}")
End Try
Input.Deskew() kullanıldığında, düşük kaliteli taramalarda doğruluk %99,8'e yükselir ve yüksek kaliteli sonuçlara neredeyse eşleşir. Bu durum, Tesseract karmaşıklıkları olmadan C# OCR için IronOCR'nin neden tercih edildiğini göstermektedir.
Görüntü filtreleri işleme zamanını biraz artırabilir ancak genel OCR süresini önemli ölçüde azaltır. Doğru dengeyi bulmanız belgenizin kalitesine bağlıdır.
Çoğu senaryoda, Input.Deskew() ve Input.DeNoise(), OCR performansında güvenilir iyileştirmeler sağlar. Görüntü ön işleme teknikleri hakkında daha fazla bilgi edinin.
OCR Performansı ve Hızı Nasıl Optimize Edilir?
C#'da görüntüleri metne dönüştürürken OCR hızı üzerinde en önemli etken giriş kalitesidir. Daha yüksek DPI (~200 dpi) ile minimal gürültü en hızlı ve en doğru sonuçları üretir.
IronOCR, kusursuz belgeleri düzeltme konusunda mükemmeldir; ancak bu iyileştirme ek işlem süresi gerektirir.
Minimal sıkıştırma artefaktları olan görüntü formatlarını seçin. TIFF ve PNG, düşük dijital gürültü nedeniyle genellikle JPEG'den daha hızlı sonuç verir.
Hangi Görüntü Filtreleri OCR Hızını Artırır?
Aşağıdaki filtreler, C# OCR görüntüden metne iş akışınızda performansı büyük ölçüde artırabilir:
OcrInput.Rotate(double degrees): Görüntüleri saat yönünde döndürür (saat yönünün tersi için negatif)OcrInput.Binarize(): Siyah/beyaza dönüştürür, düşük kontrastlı senaryolarda performansı artırırOcrInput.ToGrayScale(): Olası hız iyileştirmeleri için gri tonlamaya dönüştürürOcrInput.Contrast(): Daha iyi doğruluk için kontrastı otomatik olarak ayarlarOcrInput.DeNoise(): Gürültü beklendiğinde dijital artefaktları kaldırırOcrInput.Invert(): Siyah zemin üzerine beyaz metin için renkleri tersine çevirirOcrInput.Dilate(): Metin sınırlarını genişletirOcrInput.Erode(): Metin sınırlarını azaltırOcrInput.Deskew(): Hizalamayı düzeltir - eğri belgeler için gereklidirOcrInput.DeepCleanBackgroundNoise(): Agresif gürültü gidermeOcrInput.EnhanceResolution: Düşük çözünürlüklü görüntü kalitesini iyileştirirOcrInput.DetectPageOrientation(): Sayfa dönüşünü algılar ve düzeltir. Doğruluk/hız dengesini kontrol etmek içinOrientationDetectionModedeğerini geçirin:Fast,Balanced,DetailedveyaExtremeDetailed(v2025.8.6'da eklendi)
Scale() ve EnhanceResolution(), v2025.12.3 sürümündeki bilinen bir sorun nedeniyle SaveAsSearchablePdf() ile uyumsuzdur. Diğer tüm filtreler, aranabilir PDF çıktısıyla doğru şekilde çalışır.
IronOCR'yi Maksimum Hız için Nasıl Yapılandırırım?
Yüksek kaliteli taramaları işlerken hızı optimize etmek için bu ayarları kullanın:
using IronOcr;
// Configure for speed - ideal for clean documents
IronTesseract ocr = new IronTesseract();
// Exclude problematic characters to speed up recognition
ocr.Configuration.BlackListCharacters = "~`$#^*_{[]}|\\";
// Use automatic page segmentation
ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto;
// Select fast English language pack
ocr.Language = OcrLanguage.EnglishFast;
using (OcrInput input = new OcrInput())
{
// Load specific pages from document
int[] pageIndices = new int[] { 1, 2 };
input.LoadImageFrames(@"img\Potter.tiff", pageIndices);
// Read with optimized settings
OcrResult result = ocr.Read(input);
Console.WriteLine(result.Text);
}
using IronOcr;
// Configure for speed - ideal for clean documents
IronTesseract ocr = new IronTesseract();
// Exclude problematic characters to speed up recognition
ocr.Configuration.BlackListCharacters = "~`$#^*_{[]}|\\";
// Use automatic page segmentation
ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto;
// Select fast English language pack
ocr.Language = OcrLanguage.EnglishFast;
using (OcrInput input = new OcrInput())
{
// Load specific pages from document
int[] pageIndices = new int[] { 1, 2 };
input.LoadImageFrames(@"img\Potter.tiff", pageIndices);
// Read with optimized settings
OcrResult result = ocr.Read(input);
Console.WriteLine(result.Text);
}
Imports IronOcr
' Configure for speed - ideal for clean documents
Private ocr As New IronTesseract()
' Exclude problematic characters to speed up recognition
ocr.Configuration.BlackListCharacters = "~`$#^*_{[]}|\"
' Use automatic page segmentation
ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto
' Select fast English language pack
ocr.Language = OcrLanguage.EnglishFast
Using input As New OcrInput()
' Load specific pages from document
Dim pageIndices() As Integer = { 1, 2 }
input.LoadImageFrames("img\Potter.tiff", pageIndices)
' Read with optimized settings
Dim result As OcrResult = ocr.Read(input)
Console.WriteLine(result.Text)
End Using
Bu optimize edilmiş yapılandırma, varsayılan ayarlara kıyasla %35 hız artışı elde ederken <%99,8 doğruluk> korur.
C# OCR Kullanarak Görüntülerin Belirli Alanları Nasıl Okunur?
Aşağıdaki Iron Tesseract C# örneği, System.Drawing.Rectangle kullanılarak belirli bölgeleri hedeflemeyi göstermektedir. Metnin öngörülebilir konumlarda göründüğü standart formları işlerken bu teknik son derece değerlidir.
IronOCR Kesilmiş Bölgeleri Daha Hızlı Sonuçlar için İşleyebilir mi?
Piksel tabanlı koordinatlar kullanarak, OCR'yi belirli alanlara sınırlayabilir, hızı büyük ölçüde artırabilir ve istenmeyen metin çıkarımını önleyebilirsiniz:
using IronOcr;
using IronSoftware.Drawing;
// Initialize OCR engine for targeted region processing
var ocr = new IronTesseract();
using (var input = new OcrInput())
{
// Define exact region for OCR - coordinates in pixels
var contentArea = new System.Drawing.Rectangle(
x: 215,
y: 1250,
width: 1335,
height: 280
);
// Load image with specific area - perfect for forms and invoices
input.LoadImage("img/ComSci.png", contentArea);
// Process only the defined region
OcrResult result = ocr.Read(input);
Console.WriteLine(result.Text);
}
using IronOcr;
using IronSoftware.Drawing;
// Initialize OCR engine for targeted region processing
var ocr = new IronTesseract();
using (var input = new OcrInput())
{
// Define exact region for OCR - coordinates in pixels
var contentArea = new System.Drawing.Rectangle(
x: 215,
y: 1250,
width: 1335,
height: 280
);
// Load image with specific area - perfect for forms and invoices
input.LoadImage("img/ComSci.png", contentArea);
// Process only the defined region
OcrResult result = ocr.Read(input);
Console.WriteLine(result.Text);
}
Imports IronOcr
Imports IronSoftware.Drawing
' Initialize OCR engine for targeted region processing
Dim ocr As New IronTesseract()
Using input As New OcrInput()
' Define exact region for OCR - coordinates in pixels
Dim contentArea As New System.Drawing.Rectangle(215, 1250, 1335, 280)
' Load image with specific area - perfect for forms and invoices
input.LoadImage("img/ComSci.png", contentArea)
' Process only the defined region
Dim result As OcrResult = ocr.Read(input)
Console.WriteLine(result.Text)
End Using
Bu hedefli yaklaşım, yalnızca ilgili metni ayıklarken %41 hız artışı sağlar. faturalar, çekler ve formlar gibi yapılandırılmış belgeler için idealdir. Aynı kırpma tekniği PDF OCR işlemleri ile sorunsuz çalışır.
IronOCR'un dikdörtgen seçimi ile bölge bazlı metin çıkartımı gösteren doküman
IronOCR Kaç Dili Destekliyor?
IronOCR, uygun dil paketleri aracılığıyla 127 uluslararası dil sunar. Onları sitemizden veya NuGet Paket Yöneticisi üzerinden DLL olarak indirin.
NuGet ara yüzü aracılığıyla ("IronOcr.Languages" ara) dil paketlerini yükleyin veya tam dil paketi listesini ziyaret edin.
Desteklenen diller arasında Arapça, Çince (Basitleştirilmiş/Geleneksel), Japonca, Korece, Hintçe, Rusça, Almanca, Fransızca, İspanyolca ve 115+ diğerleri, her biri doğru metin tanıma için optimize edilmiştir.
Birden Fazla Dilde OCR Nasıl Uygulanır?
Bu IronOCR C# öğretici örneği, Arapça metin tanımayı gösterir:
Install-Package IronOcr.Languages.Arabic
IronOCR, bir GIF görüntüsünden Arapça metni doğru bir şekilde çıkartıyor
// Install-Package IronOcr.Languages.Arabic
using IronOcr;
// Configure for Arabic language OCR
var ocr = new IronTesseract();
ocr.Language = OcrLanguage.Arabic;
using (var input = new OcrInput())
{
// Load Arabic text image
input.LoadImage("img/arabic.gif");
// IronOCR handles low-quality Arabic text that standard Tesseract cannot
var result = ocr.Read(input);
// Save to file (console may not display Arabic correctly)
result.SaveAsTextFile("arabic.txt");
}
// Install-Package IronOcr.Languages.Arabic
using IronOcr;
// Configure for Arabic language OCR
var ocr = new IronTesseract();
ocr.Language = OcrLanguage.Arabic;
using (var input = new OcrInput())
{
// Load Arabic text image
input.LoadImage("img/arabic.gif");
// IronOCR handles low-quality Arabic text that standard Tesseract cannot
var result = ocr.Read(input);
// Save to file (console may not display Arabic correctly)
result.SaveAsTextFile("arabic.txt");
}
Imports IronOcr
' Configure for Arabic language OCR
Dim ocr As New IronTesseract()
ocr.Language = OcrLanguage.Arabic
Using input As New OcrInput()
' Load Arabic text image
input.LoadImage("img/arabic.gif")
' IronOCR handles low-quality Arabic text that standard Tesseract cannot
Dim result = ocr.Read(input)
' Save to file (console may not display Arabic correctly)
result.SaveAsTextFile("arabic.txt")
End Using
IronOCR Çok Dilli Belgelerle Başa Çıkabilir mi?
Belgeler karışık diller içerdiğinde, IronOCR'u çok dilli destek için yapılandırın:
Install-Package IronOcr.Languages.ChineseSimplified
// Multi-language OCR configuration
using IronOcr;
var ocr = new IronTesseract();
// Set primary language
ocr.Language = OcrLanguage.ChineseSimplified;
// Add secondary languages as needed
ocr.AddSecondaryLanguage(OcrLanguage.English);
// Custom .traineddata files can be added for specialized recognition
// ocr.AddSecondaryLanguage("path/to/custom.traineddata");
using (var input = new OcrInput())
{
// Process multi-language document
input.LoadImage("img/MultiLanguage.jpeg");
var result = ocr.Read(input);
result.SaveAsTextFile("MultiLanguage.txt");
}
// Multi-language OCR configuration
using IronOcr;
var ocr = new IronTesseract();
// Set primary language
ocr.Language = OcrLanguage.ChineseSimplified;
// Add secondary languages as needed
ocr.AddSecondaryLanguage(OcrLanguage.English);
// Custom .traineddata files can be added for specialized recognition
// ocr.AddSecondaryLanguage("path/to/custom.traineddata");
using (var input = new OcrInput())
{
// Process multi-language document
input.LoadImage("img/MultiLanguage.jpeg");
var result = ocr.Read(input);
result.SaveAsTextFile("MultiLanguage.txt");
}
Imports IronOcr
' Multi-language OCR configuration
Dim ocr As New IronTesseract()
' Set primary language
ocr.Language = OcrLanguage.ChineseSimplified
' Add secondary languages as needed
ocr.AddSecondaryLanguage(OcrLanguage.English)
' Custom .traineddata files can be added for specialized recognition
' ocr.AddSecondaryLanguage("path/to/custom.traineddata")
Using input As New OcrInput()
' Process multi-language document
input.LoadImage("img/MultiLanguage.jpeg")
Dim result = ocr.Read(input)
result.SaveAsTextFile("MultiLanguage.txt")
End Using
C# OCR ile Çoklu Sayfa Belgeler Nasıl İşlenir?
IronOCR, birden fazla sayfayı veya görüntüyü tek bir OcrResult içinde sorunsuz bir şekilde birleştirir. Bu özellik, arama yapılabilir PDF'ler oluşturma ve tam belge setlerinden metin çıkartma gibi güçlü yetenekleri olanak tanır.
Farklı kaynakları karıştırıp eşleştirin - tek bir OCR işleminde görüntüler, TIFF çerçeveleri ve PDF sayfaları:
// Multi-source document processing
using IronOcr;
IronTesseract ocr = new IronTesseract();
using (OcrInput input = new OcrInput())
{
// Add various image formats
input.LoadImage("image1.jpeg");
input.LoadImage("image2.png");
// Process specific frames from multi-frame images
int[] frameNumbers = { 1, 2 };
input.LoadImageFrames("image3.gif", frameNumbers);
// Process all sources together
OcrResult result = ocr.Read(input);
// Verify page count
Console.WriteLine($"{result.Pages.Count} Pages processed.");
}
// Multi-source document processing
using IronOcr;
IronTesseract ocr = new IronTesseract();
using (OcrInput input = new OcrInput())
{
// Add various image formats
input.LoadImage("image1.jpeg");
input.LoadImage("image2.png");
// Process specific frames from multi-frame images
int[] frameNumbers = { 1, 2 };
input.LoadImageFrames("image3.gif", frameNumbers);
// Process all sources together
OcrResult result = ocr.Read(input);
// Verify page count
Console.WriteLine($"{result.Pages.Count} Pages processed.");
}
Imports IronOcr
' Multi-source document processing
Dim ocr As New IronTesseract()
Using input As New OcrInput()
' Add various image formats
input.LoadImage("image1.jpeg")
input.LoadImage("image2.png")
' Process specific frames from multi-frame images
Dim frameNumbers As Integer() = {1, 2}
input.LoadImageFrames("image3.gif", frameNumbers)
' Process all sources together
Dim result As OcrResult = ocr.Read(input)
' Verify page count
Console.WriteLine($"{result.Pages.Count} Pages processed.")
End Using
Bir TIFF dosyasının tüm sayfalarını verimli bir şekilde işleyin:
using IronOcr;
IronTesseract ocr = new IronTesseract();
using (OcrInput input = new OcrInput())
{
// Define pages to process (0-based indexing)
int[] pageIndices = new int[] { 0, 1 };
// Load specific TIFF frames
input.LoadImageFrames("MultiFrame.Tiff", pageIndices);
// Extract text from all frames
OcrResult result = ocr.Read(input);
Console.WriteLine(result.Text);
Console.WriteLine($"{result.Pages.Count} Pages processed");
}
using IronOcr;
IronTesseract ocr = new IronTesseract();
using (OcrInput input = new OcrInput())
{
// Define pages to process (0-based indexing)
int[] pageIndices = new int[] { 0, 1 };
// Load specific TIFF frames
input.LoadImageFrames("MultiFrame.Tiff", pageIndices);
// Extract text from all frames
OcrResult result = ocr.Read(input);
Console.WriteLine(result.Text);
Console.WriteLine($"{result.Pages.Count} Pages processed");
}
Imports IronOcr
Private ocr As New IronTesseract()
Using input As New OcrInput()
' Define pages to process (0-based indexing)
Dim pageIndices() As Integer = { 0, 1 }
' Load specific TIFF frames
input.LoadImageFrames("MultiFrame.Tiff", pageIndices)
' Extract text from all frames
Dim result As OcrResult = ocr.Read(input)
Console.WriteLine(result.Text)
Console.WriteLine($"{result.Pages.Count} Pages processed")
End Using
TIFF'leri veya PDF'leri arama yapılabilir formatlara dönüştürün:
using System;
using IronOcr;
IronTesseract ocr = new IronTesseract();
using (OcrInput input = new OcrInput())
{
// Set document metadata
input.Title = "Quarterly Report";
// Combine multiple sources
input.LoadImage("image1.jpeg");
input.LoadImage("image2.png");
// Add specific frames from animated images
int[] gifFrames = new int[] { 1, 2 };
input.LoadImageFrames("image3.gif", gifFrames);
// Create searchable PDF
OcrResult result = ocr.Read(input);
// Pass true to apply any active OcrInput filters to the searchable PDF output (added v2025.5.11)
result.SaveAsSearchablePdf("searchable.pdf", true);
}
using System;
using IronOcr;
IronTesseract ocr = new IronTesseract();
using (OcrInput input = new OcrInput())
{
// Set document metadata
input.Title = "Quarterly Report";
// Combine multiple sources
input.LoadImage("image1.jpeg");
input.LoadImage("image2.png");
// Add specific frames from animated images
int[] gifFrames = new int[] { 1, 2 };
input.LoadImageFrames("image3.gif", gifFrames);
// Create searchable PDF
OcrResult result = ocr.Read(input);
// Pass true to apply any active OcrInput filters to the searchable PDF output (added v2025.5.11)
result.SaveAsSearchablePdf("searchable.pdf", true);
}
Imports System
Imports IronOcr
Dim ocr As New IronTesseract()
Using input As New OcrInput()
' Set document metadata
input.Title = "Quarterly Report"
' Combine multiple sources
input.LoadImage("image1.jpeg")
input.LoadImage("image2.png")
' Add specific frames from animated images
Dim gifFrames As Integer() = {1, 2}
input.LoadImageFrames("image3.gif", gifFrames)
' Create searchable PDF
Dim result As OcrResult = ocr.Read(input)
' Pass true to apply any active OcrInput filters to the searchable PDF output (added v2025.5.11)
result.SaveAsSearchablePdf("searchable.pdf", True)
End Using
Mevcut PDF'leri arama yapılabilir versiyonlara dönüştürün:
using IronOcr;
var ocr = new IronTesseract();
using (var input = new OcrInput())
{
// Set PDF metadata
input.Title = "Annual Report 2024";
// Process existing PDF
input.LoadPdf("example.pdf", "password");
// Generate searchable version
var result = ocr.Read(input);
result.SaveAsSearchablePdf("searchable.pdf");
}
using IronOcr;
var ocr = new IronTesseract();
using (var input = new OcrInput())
{
// Set PDF metadata
input.Title = "Annual Report 2024";
// Process existing PDF
input.LoadPdf("example.pdf", "password");
// Generate searchable version
var result = ocr.Read(input);
result.SaveAsSearchablePdf("searchable.pdf");
}
Imports IronOcr
Private ocr = New IronTesseract()
Using input = New OcrInput()
' Set PDF metadata
input.Title = "Annual Report 2024"
' Process existing PDF
input.LoadPdf("example.pdf", "password")
' Generate searchable version
Dim result = ocr.Read(input)
result.SaveAsSearchablePdf("searchable.pdf")
End Using
Aynı tekniği TIFF dönüştürmelerinde uygulayın:
using IronOcr;
var ocr = new IronTesseract();
using (var input = new OcrInput())
{
// Configure document properties
input.Title = "Scanned Archive Document";
// Select pages to process
var pageIndices = new int[] { 1, 2 };
input.LoadImageFrames("example.tiff", pageIndices);
// Create searchable PDF from TIFF
OcrResult result = ocr.Read(input);
result.SaveAsSearchablePdf("searchable.pdf");
}
using IronOcr;
var ocr = new IronTesseract();
using (var input = new OcrInput())
{
// Configure document properties
input.Title = "Scanned Archive Document";
// Select pages to process
var pageIndices = new int[] { 1, 2 };
input.LoadImageFrames("example.tiff", pageIndices);
// Create searchable PDF from TIFF
OcrResult result = ocr.Read(input);
result.SaveAsSearchablePdf("searchable.pdf");
}
Imports IronOcr
Private ocr = New IronTesseract()
Using input = New OcrInput()
' Configure document properties
input.Title = "Scanned Archive Document"
' Select pages to process
Dim pageIndices = New Integer() { 1, 2 }
input.LoadImageFrames("example.tiff", pageIndices)
' Create searchable PDF from TIFF
Dim result As OcrResult = ocr.Read(input)
result.SaveAsSearchablePdf("searchable.pdf")
End Using
OCR Sonuçlarını HOCR HTML Olarak Nasıl Dışa Aktarırım?
IronOCR, düzen bilgilerini korurken PDF'den HTML'ye ve TIFF'ten HTML'ye yapılandırılmış dönüşümler sağlayan HOCR HTML dışa aktarma desteğine sahiptir.
using IronOcr;
var ocr = new IronTesseract();
using (var input = new OcrInput())
{
// Set HTML title
input.Title = "Document Archive";
// Process multiple document types
input.LoadImage("image2.jpeg");
input.LoadPdf("example.pdf", "password");
// Add TIFF pages
var pageIndices = new int[] { 1, 2 };
input.LoadImageFrames("example.tiff", pageIndices);
// Export as HOCR with position data
OcrResult result = ocr.Read(input);
result.SaveAsHocrFile("hocr.html");
}
using IronOcr;
var ocr = new IronTesseract();
using (var input = new OcrInput())
{
// Set HTML title
input.Title = "Document Archive";
// Process multiple document types
input.LoadImage("image2.jpeg");
input.LoadPdf("example.pdf", "password");
// Add TIFF pages
var pageIndices = new int[] { 1, 2 };
input.LoadImageFrames("example.tiff", pageIndices);
// Export as HOCR with position data
OcrResult result = ocr.Read(input);
result.SaveAsHocrFile("hocr.html");
}
Imports IronOcr
Dim ocr As New IronTesseract()
Using input As New OcrInput()
' Set HTML title
input.Title = "Document Archive"
' Process multiple document types
input.LoadImage("image2.jpeg")
input.LoadPdf("example.pdf", "password")
' Add TIFF pages
Dim pageIndices As Integer() = {1, 2}
input.LoadImageFrames("example.tiff", pageIndices)
' Export as HOCR with position data
Dim result As OcrResult = ocr.Read(input)
result.SaveAsHocrFile("hocr.html")
End Using
IronOCR Metinle Birlikte Barkodları da Okuyabilir mi?
IronOCR, ayrı kütüphanelere olan ihtiyacı ortadan kaldırarak barkod okuma yetenekleri ile metin tanımayı eşsiz bir şekilde birleştirir.
// Enable combined text and barcode recognition
using IronOcr;
var ocr = new IronTesseract();
// Enable barcode detection
ocr.Configuration.ReadBarCodes = true;
using (var input = new OcrInput())
{
// Load image containing both text and barcodes
input.LoadImage("img/Barcode.png");
// Process both text and barcodes
var result = ocr.Read(input);
// Extract barcode data
foreach (var barcode in result.Barcodes)
{
Console.WriteLine($"Barcode Value: {barcode.Value}");
Console.WriteLine($"Type: {barcode.Type}, Location: {barcode.Location}");
}
}
// Enable combined text and barcode recognition
using IronOcr;
var ocr = new IronTesseract();
// Enable barcode detection
ocr.Configuration.ReadBarCodes = true;
using (var input = new OcrInput())
{
// Load image containing both text and barcodes
input.LoadImage("img/Barcode.png");
// Process both text and barcodes
var result = ocr.Read(input);
// Extract barcode data
foreach (var barcode in result.Barcodes)
{
Console.WriteLine($"Barcode Value: {barcode.Value}");
Console.WriteLine($"Type: {barcode.Type}, Location: {barcode.Location}");
}
}
Imports IronOcr
Dim ocr As New IronTesseract()
' Enable barcode detection
ocr.Configuration.ReadBarCodes = True
Using input As New OcrInput()
' Load image containing both text and barcodes
input.LoadImage("img/Barcode.png")
' Process both text and barcodes
Dim result = ocr.Read(input)
' Extract barcode data
For Each barcode In result.Barcodes
Console.WriteLine($"Barcode Value: {barcode.Value}")
Console.WriteLine($"Type: {barcode.Type}, Location: {barcode.Location}")
Next
End Using
Detaylı OCR Sonuçları ve Meta Verilere Nasıl Erişilir?
IronOCR sonuç nesnesi, ilerlemiş geliştiricilerin karmaşık uygulamalarda faydalanabilecekleri kapsamlı veriler sağlar.
Her OcrResult, sayfalar, paragraflar, satırlar, WORDlar ve karakterler gibi hiyerarşik koleksiyonlar içerir. Tüm öğeler, yer, yazı tipi bilgisi ve güven puanları gibi ayrıntılı metaverileri içerir.
Bireysel öğeler (paragraflar, kelimeler, barkodlar) ek işlem için görüntüler veya bit eşlemler halinde dışa aktarılabilir:
using System;
using IronOcr;
using IronSoftware.Drawing;
// Configure with barcode support
IronTesseract ocr = new IronTesseract
{
Configuration = { ReadBarCodes = true }
};
using OcrInput input = new OcrInput();
// Process multi-page document
int[] pageIndices = { 1, 2 };
input.LoadImageFrames(@"img\Potter.tiff", pageIndices);
OcrResult result = ocr.Read(input);
// Navigate the complete results hierarchy
foreach (var page in result.Pages)
{
// Page-level data
int pageNumber = page.PageNumber;
string pageText = page.Text;
int pageWordCount = page.WordCount;
// Extract page elements
OcrResult.Barcode[] barcodes = page.Barcodes;
AnyBitmap pageImage = page.ToBitmap();
double pageWidth = page.Width;
double pageHeight = page.Height;
foreach (var paragraph in page.Paragraphs)
{
// Paragraph properties
int paragraphNumber = paragraph.ParagraphNumber;
string paragraphText = paragraph.Text;
double paragraphConfidence = paragraph.Confidence;
var textDirection = paragraph.TextDirection;
foreach (var line in paragraph.Lines)
{
// Line details including baseline information
string lineText = line.Text;
double lineConfidence = line.Confidence;
double baselineAngle = line.BaselineAngle;
double baselineOffset = line.BaselineOffset;
foreach (var word in line.Words)
{
// Word-level data
string wordText = word.Text;
double wordConfidence = word.Confidence;
// Font information (when available)
if (word.Font != null)
{
string fontName = word.Font.FontName;
double fontSize = word.Font.FontSize;
bool isBold = word.Font.IsBold;
bool isItalic = word.Font.IsItalic;
}
foreach (var character in word.Characters)
{
// Character-level analysis
string charText = character.Text;
double charConfidence = character.Confidence;
// Alternative character choices for spell-checking
OcrResult.Choice[] alternatives = character.Choices;
}
}
}
}
}
using System;
using IronOcr;
using IronSoftware.Drawing;
// Configure with barcode support
IronTesseract ocr = new IronTesseract
{
Configuration = { ReadBarCodes = true }
};
using OcrInput input = new OcrInput();
// Process multi-page document
int[] pageIndices = { 1, 2 };
input.LoadImageFrames(@"img\Potter.tiff", pageIndices);
OcrResult result = ocr.Read(input);
// Navigate the complete results hierarchy
foreach (var page in result.Pages)
{
// Page-level data
int pageNumber = page.PageNumber;
string pageText = page.Text;
int pageWordCount = page.WordCount;
// Extract page elements
OcrResult.Barcode[] barcodes = page.Barcodes;
AnyBitmap pageImage = page.ToBitmap();
double pageWidth = page.Width;
double pageHeight = page.Height;
foreach (var paragraph in page.Paragraphs)
{
// Paragraph properties
int paragraphNumber = paragraph.ParagraphNumber;
string paragraphText = paragraph.Text;
double paragraphConfidence = paragraph.Confidence;
var textDirection = paragraph.TextDirection;
foreach (var line in paragraph.Lines)
{
// Line details including baseline information
string lineText = line.Text;
double lineConfidence = line.Confidence;
double baselineAngle = line.BaselineAngle;
double baselineOffset = line.BaselineOffset;
foreach (var word in line.Words)
{
// Word-level data
string wordText = word.Text;
double wordConfidence = word.Confidence;
// Font information (when available)
if (word.Font != null)
{
string fontName = word.Font.FontName;
double fontSize = word.Font.FontSize;
bool isBold = word.Font.IsBold;
bool isItalic = word.Font.IsItalic;
}
foreach (var character in word.Characters)
{
// Character-level analysis
string charText = character.Text;
double charConfidence = character.Confidence;
// Alternative character choices for spell-checking
OcrResult.Choice[] alternatives = character.Choices;
}
}
}
}
}
Imports System
Imports IronOcr
Imports IronSoftware.Drawing
' Configure with barcode support
Private ocr As New IronTesseract With {
.Configuration = { ReadBarCodes = True }
}
Private OcrInput As using
' Process multi-page document
Private pageIndices() As Integer = { 1, 2 }
input.LoadImageFrames("img\Potter.tiff", pageIndices)
Dim result As OcrResult = ocr.Read(input)
' Navigate the complete results hierarchy
For Each page In result.Pages
' Page-level data
Dim pageNumber As Integer = page.PageNumber
Dim pageText As String = page.Text
Dim pageWordCount As Integer = page.WordCount
' Extract page elements
Dim barcodes() As OcrResult.Barcode = page.Barcodes
Dim pageImage As AnyBitmap = page.ToBitmap()
Dim pageWidth As Double = page.Width
Dim pageHeight As Double = page.Height
For Each paragraph In page.Paragraphs
' Paragraph properties
Dim paragraphNumber As Integer = paragraph.ParagraphNumber
Dim paragraphText As String = paragraph.Text
Dim paragraphConfidence As Double = paragraph.Confidence
Dim textDirection = paragraph.TextDirection
For Each line In paragraph.Lines
' Line details including baseline information
Dim lineText As String = line.Text
Dim lineConfidence As Double = line.Confidence
Dim baselineAngle As Double = line.BaselineAngle
Dim baselineOffset As Double = line.BaselineOffset
For Each word In line.Words
' Word-level data
Dim wordText As String = word.Text
Dim wordConfidence As Double = word.Confidence
' Font information (when available)
If word.Font IsNot Nothing Then
Dim fontName As String = word.Font.FontName
Dim fontSize As Double = word.Font.FontSize
Dim isBold As Boolean = word.Font.IsBold
Dim isItalic As Boolean = word.Font.IsItalic
End If
For Each character In word.Characters
' Character-level analysis
Dim charText As String = character.Text
Dim charConfidence As Double = character.Confidence
' Alternative character choices for spell-checking
Dim alternatives() As OcrResult.Choice = character.Choices
Next character
Next word
Next line
Next paragraph
Next page
Özet
IronOCR, Windows, Linux ve Mac platformlarında sorunsuz çalışmak üzere, C# geliştiricilerine en gelişmiş Tesseract API uygulaması sunar. IronOCR kullanarak resimden metni doğru bir şekilde okumadaki yeteneği - hatta kusurlu belgelerden - temel OCR çözümlerinden ayıran şey budur.
Kütüphanenin benzersiz özellikleri arasında, entegre barkod okuma ve standart Tesseract uygulamalarında bulunmayan arama yapılabilir PDF veya HOCR HTML olarak sonuçları dışa aktarma yeteneği vardır.
İleriye Doğru
IronOCR'u daha iyi öğrenmeye devam edin:
- kapsamlı başlarken kılavuzumuzu keşfedin
- pratik C# kod örneklerine göz atın
- detaylı API dokümantasyonu referans alın
Kaynak Kodu İndir
Uygulamalarınızda C# OCR resimden metin dönüştürmeyi uygulamaya hazır mısınız? IronOCR'u indir ve bugün ücretsiz denemenizi başlatın.
Sıkça Sorulan Sorular
Tesseract kullanmadan c# dilinde görüntüleri metne nasıl dönüştürebilirim?
Tesseract ihtiyacı olmadan, IronOCR'u kullanarak C# dilinde görüntüleri metne dönüştürebilirsiniz. IronOCR, görüntüden metne dönüşümü doğrudan ele alan yerleşik yöntemler ile süreci basitleştirir.
Düşük kaliteli görüntülerde OCR doğruluğunu nasıl artırabilirim?
IronOCR, Input.Deskew() ve Input.DeNoise() gibi görüntü filtreleri sağlar. Bu filtreler, eğriliği düzelterek ve gürültüyü azaltarak düşük kaliteli görüntüleri iyileştirebilir, bu da OCR doğruluğunu önemli ölçüde artırır.
C# kullanarak çok sayfalı bir belgeden metin çıkarmak için hangi adımlar izlenmelidir?
Çok sayfalı belgelerden metin çıkarmak için, IronOCR her bir sayfayı LoadPdf() gibi yöntemlerle PDF'leri yükleyerek veya TIFF dosyalarını işleyerek yükleyip işlem yapmayı sağlar ve böylelikle her sayfayı metne dönüştürür.
Bir görüntüden barkod ve metni aynı anda okumak mümkün mü?
Evet, IronOCR tek bir görüntüden hem metin hem de barkod okuyabilir. ocr.Configuration.ReadBarCodes = true ile barkod okunmasını etkinleştirebilir, bu da hem metin hem de barkod verilerinin çıkarılmasına imkan tanır.
Birçok dilde belge işlemek için OCR'yi nasıl kurabilirim?
IronOCR, 125'ten fazla dili destekler ve birincil dili ocr.Language ile ayarlamanıza ve çok dilli belge işlemine yönelik ek diller eklemek için ocr.AddSecondaryLanguage() kullanmanıza olanak tanır.
OCR sonuçlarını farklı formatlarda dışa aktarmak için hangi yöntemler mevcuttur?
IronOCR, OCR sonuçlarını dışa aktarmak için SaveAsSearchablePdf() gibi yöntemler sunar. Bu yöntemler, PDF'ler için aranabilir PDF, düz metin için SaveAsTextFile() ve HOCR HTML formatı için SaveAsHocrFile() sunar.
Büyük görüntü dosyaları için OCR işlem hızını nasıl optimize edebilirim?
OCR işlem hızını optimize etmek için, IronOCR'un OcrLanguage.EnglishFast gibi daha hızlı dil tanıma seçeneklerini kullanın ve işlem sürelerini azaltmak için System.Drawing.Rectangle kullanarak OCR için belirli bölgeleri tanımlayın.
Korumalı PDF dosyaları için OCR işlemini nasıl yönetirim?
Korumalı PDF'lerle çalışırken, doğru parolayla birlikte LoadPdf() yöntemini kullanın. IronOCR, sayfaları otomatik olarak OCR işlemi için resimlere dönüştürerek görüntü tabanlı PDF'leri işler.
Eğer OCR sonuçlarım doğru değilse ne yapmalıyım?
Eğer OCR sonuçları yanlışsa, Input.Deskew() ve Input.DeNoise() gibi IronOCR'nin görüntü geliştirme özelliklerini kullanmayı ve doğru dil paketlerinin kurulu olduğundan emin olmayı düşünün.
OCR sürecini belirli karakterleri hariç tutacak şekilde özelleştirebilir miyim?
Evet, IronOCR, OCR sürecini, sadece ilgili metne odaklanarak doğruluğu ve işlem hızını artırmak için BlackListCharacters özelliğini kullanarak belirli karakterleri hariç tutacak şekilde özelleştirmenize izin verir.

