VB.NET代码让您入门

C# + VB.NET: 自动OCR 自动OCR
using IronOcr;

string imageText = new IronTesseract().Read(@"images\image.png").Text;
Imports IronOcr

Private imageText As String = (New IronTesseract()).Read("images\image.png").Text

<p>IronOCR 在其自动检测和读取来自扫描不完美的图像和 PDF 文档中的文本的能力方面具有独特性。 <code>IronTesseract</code> 类提供了最简单的 API。</p> <p>尝试其他代码示例以精细控制您的C# OCR操作。</p> <p>IronOCR 提供了目前任何平台上最先进的 Tesseract 构建。 具有更高的速度、准确性以及原生的DLL和API。</p> <p>支持适用于 .NET Framework、Standard、Core、Xamarin 和 Mono 的 Tesseract 3、Tesseract 4 和 Tesseract 5。</p> <div class="hsg-featured-snippet"> <h2>如何在 VB.NET 中进行 OCR</h2> <ol> <li><a class="js-modal-open" data-modal-id="trial-license-after-download" href="https://nuget.org/packages/IronOcr/" target="_blank" rel="nofollow noopener noreferrer">安装 VB.NET 库,对图像或 PDF 进行 OCR 识别</a></li> <li>实例化 <code>钢铁魔方</code> 使用直观的应用程序接口</li> <li>利用 <code>读取</code> 方法在 VB.NET 中执行 OCR</li> <li>通过访问 `Text` 属性获取 OCR 结果</li> <li>在一行代码中执行 2、3 和 4 个操作。</li> </ol> </div>

C# + VB.NET: 国际语言 国际语言
using IronOcr;
using System;

var ocrTesseract = new IronTesseract();

ocrTesseract.Language = OcrLanguage.Arabic;

using (var ocrInput = new OcrInput())
{
    ocrInput.LoadImage(@"images\arabic.gif");
    var ocrResult = ocrTesseract.Read(ocrInput);
    Console.WriteLine(ocrResult.Text);
}

// Example with a Custom Trained Font Being used:

var ocrTesseractCustomerLang = new IronTesseract();
ocrTesseractCustomerLang.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata");
ocrTesseractCustomerLang.AddSecondaryLanguage(OcrLanguage.EnglishBest);

using (var ocrInput = new OcrInput())
{
    ocrInput.LoadPdf(@"images\mixed-lang.pdf");
    var ocrResult = ocrTesseractCustomerLang.Read(ocrInput);
    Console.WriteLine(ocrResult.Text);
}
Imports IronOcr
Imports System

Private ocrTesseract = New IronTesseract()

ocrTesseract.Language = OcrLanguage.Arabic

Using ocrInput As New OcrInput()
	ocrInput.LoadImage("images\arabic.gif")
	Dim ocrResult = ocrTesseract.Read(ocrInput)
	Console.WriteLine(ocrResult.Text)
End Using

' Example with a Custom Trained Font Being used:

Dim ocrTesseractCustomerLang = New IronTesseract()
ocrTesseractCustomerLang.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata")
ocrTesseractCustomerLang.AddSecondaryLanguage(OcrLanguage.EnglishBest)

Using ocrInput As New OcrInput()
	ocrInput.LoadPdf("images\mixed-lang.pdf")
	Dim ocrResult = ocrTesseractCustomerLang.Read(ocrInput)
	Console.WriteLine(ocrResult.Text)
End Using

<p>IronOCR支持125种国际语言。</p> <p>除了默认安装的英语外,还可以通过NuGet添加语言包到您的.NET项目中,或者从我们的网站下载。<a href="/csharp/ocr/languages/" target="_blank" rel="nofollow noopener noreferrer">语言页面</a>.</p> <p>大多数语言都有快速和标准版本可用。(推荐)和最佳质量。 最好可能更准确,但也更慢。</p>

C# + VB.NET: 结果对象 结果对象
using IronOcr;
using IronSoftware.Drawing;

// We can delve deep into OCR results as an object model of
// Pages, Barcodes, Paragraphs, Lines, Words and Characters
// This allows us to explore, export and draw OCR content using other APIs/
var ocrTesseract = new IronTesseract();

ocrTesseract.Configuration.ReadBarCodes = true;

using var ocrInput = new OcrInput();
var pages = new int[] { 1, 2 };
ocrInput.LoadImageFrames("example.tiff", pages);

OcrResult ocrResult = ocrTesseract.Read(ocrInput);
foreach (var page in ocrResult.Pages)
{
    // Page object
    int PageNumber = page.PageNumber;
    string PageText = page.Text;
    int PageWordCount = page.WordCount;
    // null if we dont set Ocr.Configuration.ReadBarCodes = true;
    OcrResult.Barcode[] Barcodes = page.Barcodes;
    AnyBitmap PageImage = page.ToBitmap(ocrInput);
    double PageWidth = page.Width;
    double PageHeight = page.Height;
    double PageRotation = page.Rotation; // angular correction in degrees from OcrInput.Deskew()

    foreach (var paragraph in page.Paragraphs)
    {
        // Pages -> Paragraphs
        int ParagraphNumber = paragraph.ParagraphNumber;
        string ParagraphText = paragraph.Text;
        AnyBitmap ParagraphImage = paragraph.ToBitmap(ocrInput);
        int ParagraphX_location = paragraph.X;
        int ParagraphY_location = paragraph.Y;
        int ParagraphWidth = paragraph.Width;
        int ParagraphHeight = paragraph.Height;
        double ParagraphOcrAccuracy = paragraph.Confidence;
        OcrResult.TextFlow paragrapthText_direction = paragraph.TextDirection;
        foreach (var line in paragraph.Lines)
        {
            // Pages -> Paragraphs -> Lines
            int LineNumber = line.LineNumber;
            string LineText = line.Text;
            AnyBitmap LineImage = line.ToBitmap(ocrInput);
            int LineX_location = line.X;
            int LineY_location = line.Y;
            int LineWidth = line.Width;
            int LineHeight = line.Height;
            double LineOcrAccuracy = line.Confidence;
            double LineSkew = line.BaselineAngle;
            double LineOffset = line.BaselineOffset;
            foreach (var word in line.Words)
            {
                // Pages -> Paragraphs -> Lines -> Words
                int WordNumber = word.WordNumber;
                string WordText = word.Text;
                AnyBitmap WordImage = word.ToBitmap(ocrInput);
                int WordX_location = word.X;
                int WordY_location = word.Y;
                int WordWidth = word.Width;
                int WordHeight = word.Height;
                double WordOcrAccuracy = word.Confidence;
                foreach (var character in word.Characters)
                {
                    // Pages -> Paragraphs -> Lines -> Words -> Characters
                    int CharacterNumber = character.CharacterNumber;
                    string CharacterText = character.Text;
                    AnyBitmap CharacterImage = character.ToBitmap(ocrInput);
                    int CharacterX_location = character.X;
                    int CharacterY_location = character.Y;
                    int CharacterWidth = character.Width;
                    int CharacterHeight = character.Height;
                    double CharacterOcrAccuracy = character.Confidence;
                    // Output alternative symbols choices and their probability.
                    // Very useful for spellchecking
                    OcrResult.Choice[] Choices = character.Choices;
                }
            }
        }
    }
}
Imports IronOcr
Imports IronSoftware.Drawing

' We can delve deep into OCR results as an object model of
' Pages, Barcodes, Paragraphs, Lines, Words and Characters
' This allows us to explore, export and draw OCR content using other APIs/
Private ocrTesseract = New IronTesseract()

ocrTesseract.Configuration.ReadBarCodes = True

Dim ocrInput As New OcrInput()
Dim pages = New Integer() { 1, 2 }
ocrInput.LoadImageFrames("example.tiff", pages)

Dim ocrResult As OcrResult = ocrTesseract.Read(ocrInput)
For Each page In ocrResult.Pages
	' Page object
	Dim PageNumber As Integer = page.PageNumber
	Dim PageText As String = page.Text
	Dim PageWordCount As Integer = page.WordCount
	' null if we dont set Ocr.Configuration.ReadBarCodes = true;
	Dim Barcodes() As OcrResult.Barcode = page.Barcodes
	Dim PageImage As AnyBitmap = page.ToBitmap(ocrInput)
	Dim PageWidth As Double = page.Width
	Dim PageHeight As Double = page.Height
	Dim PageRotation As Double = page.Rotation ' angular correction in degrees from OcrInput.Deskew()

	For Each paragraph In page.Paragraphs
		' Pages -> Paragraphs
		Dim ParagraphNumber As Integer = paragraph.ParagraphNumber
		Dim ParagraphText As String = paragraph.Text
		Dim ParagraphImage As AnyBitmap = paragraph.ToBitmap(ocrInput)
		Dim ParagraphX_location As Integer = paragraph.X
		Dim ParagraphY_location As Integer = paragraph.Y
		Dim ParagraphWidth As Integer = paragraph.Width
		Dim ParagraphHeight As Integer = paragraph.Height
		Dim ParagraphOcrAccuracy As Double = paragraph.Confidence
		Dim paragrapthText_direction As OcrResult.TextFlow = paragraph.TextDirection
		For Each line In paragraph.Lines
			' Pages -> Paragraphs -> Lines
			Dim LineNumber As Integer = line.LineNumber
			Dim LineText As String = line.Text
			Dim LineImage As AnyBitmap = line.ToBitmap(ocrInput)
			Dim LineX_location As Integer = line.X
			Dim LineY_location As Integer = line.Y
			Dim LineWidth As Integer = line.Width
			Dim LineHeight As Integer = line.Height
			Dim LineOcrAccuracy As Double = line.Confidence
			Dim LineSkew As Double = line.BaselineAngle
			Dim LineOffset As Double = line.BaselineOffset
			For Each word In line.Words
				' Pages -> Paragraphs -> Lines -> Words
				Dim WordNumber As Integer = word.WordNumber
				Dim WordText As String = word.Text
				Dim WordImage As AnyBitmap = word.ToBitmap(ocrInput)
				Dim WordX_location As Integer = word.X
				Dim WordY_location As Integer = word.Y
				Dim WordWidth As Integer = word.Width
				Dim WordHeight As Integer = word.Height
				Dim WordOcrAccuracy As Double = word.Confidence
				For Each character In word.Characters
					' Pages -> Paragraphs -> Lines -> Words -> Characters
					Dim CharacterNumber As Integer = character.CharacterNumber
					Dim CharacterText As String = character.Text
					Dim CharacterImage As AnyBitmap = character.ToBitmap(ocrInput)
					Dim CharacterX_location As Integer = character.X
					Dim CharacterY_location As Integer = character.Y
					Dim CharacterWidth As Integer = character.Width
					Dim CharacterHeight As Integer = character.Height
					Dim CharacterOcrAccuracy As Double = character.Confidence
					' Output alternative symbols choices and their probability.
					' Very useful for spellchecking
					Dim Choices() As OcrResult.Choice = character.Choices
				Next character
			Next word
		Next line
	Next paragraph
Next page

<p>IronOCR使用Tesseract 5为它扫描的每个页面返回一个高级结果对象。 此包括每个项目的<strong>位置数据、图像、文本、统计置信度、备选符号选择、字体名称、字体大小、字体装饰、字体粗细和位置</strong>。</p> <ul> <li>页次</li> <li>段落</li> <li>文本行</li> <li>字词</li> <li>单个字符</li> <li>和条形码</li> </ul>

Human Support related to 在 VB.NET 中的 OCR

来自我们团队的支持

对于产品或许可问题,Iron 团队随时准备为您提供支持。将您的问题发送给我们,我们将确保 Iron 的合适人员为您解答。

联系我们
Image To Text related to 在 VB.NET 中的 OCR

在VB.NET应用程序中将图像OCR转为文本

可以将单页或多页发送到IronOCR。您将收到所有文字、条形码和二维码内容。为.NET控制台、Web或桌面应用程序添加OCR功能。图像可以以PDF、JPG、PNG、GIF、BMP和TIFF格式提交。

VB.NET, .NET, C#

查看教程
Fast And Polite Behavior related to 在 VB.NET 中的 OCR

快速且准确的结果的OCR

光学字符识别软件以多种字体样式查看内容,以实现精确的文本OCR。使用矩形读取区域以提高速度和准确性。多核多线程提高OCR读取速度。

API参考文档
Advanced Image related to 在 VB.NET 中的 OCR

图像处理用于不完美扫描识别

IronOCR 的真正特别之处在于它能够读取扫描质量较差的文档。其独特的预处理库能够减少背景噪音、旋转、失真和倾斜对齐,并简化颜色和增强分辨率和对比度。Iron 的 AutoOCR 和 Advanced OCR 设置为开发人员提供了每次都能获得最佳结果的工具。

了解更多
Support For Languages related to 在 VB.NET 中的 OCR

多语言OCR

可提供语言包:阿拉伯语、简体中文、繁体中文、丹麦语、英语、芬兰语、法语、德语、希伯来语、意大利语、日语、韩语、葡萄牙语、俄语、西班牙语和瑞典语。可根据要求支持其他语言。

了解更多
Output Content related to 在 VB.NET 中的 OCR

数据直接导出到您的 VB.NET 应用程序

IronOCR输出内容为纯文本和条形码数据。另一种结构化数据对象模型允许开发人员以结构化标题、段落、行、单词和字符的格式接收所有内容,以便直接输入到.NET应用程序中。

了解更多
支持:
  • .NET Framework 4.0及以上版本支持C#、VB、F#
  • Microsoft Visual Studio .NET 开发IDE图标
  • Visual Studio 的 NuGet 安装程序支持
  • JetBrains ReSharper C#语言助手兼容
  • 与Microsoft Azure C# .NET托管平台兼容

许可与定价

免费 社区开发许可证。商业许可证起价$749。

项目 C# + VB.NET 库许可

项目

开发人员 C# + VB.NET 库许可

开发者

组织 C# + VB.NET 库许可

组织

代理C# + VB.NET库授权

机构

SaaS C# + VB.NET库许可

软件即服务

OEM C# + VB.NET 库授权

原始设备制造商

查看完整的许可选项  

VB.NET光学字符识别教程

C# 的 Tesseract 教程 | IronOCR

C# Tesseract 光学字符识别

Jim Baker是Iron公司的开发工程师,负责开发OCR产品。

IronOCR 和 Tesseract 对比 .NET

吉姆一直是IronOCR开发的领军人物。吉姆设计和构建用于OCR的图像处理算法和读取方法。

查看 Jim 的 Tesseract 比较
如何在 .NET 中从图像读取文本 | 教程

C# 光学字符识别 ASP.NET

杰玛·贝克福德 - 微软解决方案工程师

如何在C# .NET中从图像读取文本

了解 Gemma 的团队如何使用 IronOCR 从图像中读取文本以用于他们的归档软件。Gemma 分享了她自己的代码示例。

查看Gemma的图片转文本教程
VB程序员使用IronOCR用于...

会计和财务系统

  • # 收据
  • # 报告
  • # 发票打印
将 PDF 支持添加到 ASP.NET 会计和财务系统中

业务数字化

  • # 文档
  • # 订购与标签
  • # 纸张替代
C# 业务数字化用例

企业内容管理

  • # 内容制作
  • # 文档管理
  • # 内容分发
.NET CMS PDF支持

数据和报告应用程序

  • # 性能跟踪
  • # 趋势图绘制
  • # 报告
C# PDF报告
Iron .NET 客戶

成千上万的公司、政府、中小企业和开发人员都信任Iron软件产品。

Iron的团队在.NET软件组件市场拥有超过10年的经验。

Nexudus
马瓦尔
医疗代码
澳新
Equinor
福莱
通用电气
Vireq