高级阅读的 OCR 配置
IronOCR 提供了先进的扫描读取方法,如 ReadPassport、ReadLicensePlate 和 ReadPhoto,超越了标准的 OCR。 这些方法由IronOcr.Extensions.AdvancedScan包提供支持。 为了微调这些方法处理文本的方式,IronOCR提供了TesseractConfiguration类,让开发者可以完全控制字符白名单、黑名单、条形码检测、数据表读取等。
本文介绍了可用于高级读取的TesseractConfiguration属性以及在实际场景中配置OCR的实用示例。
在调用 Read 之前,在 TesseractConfiguration 上设置 WhiteListCharacters。 任何不在白名单中的字符都会被静默地从结果中删除,从而消除噪声而无需任何后期处理。
-
1使用 IronOCR 安装 NuGet Package Manager
-
2复制并运行这段代码。
var input = new OcrInput(); input.LoadImage("image.png"); var result = new IronTesseract() { Configuration = new TesseractConfiguration { WhiteListCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789- " } }.Read(input); Console.WriteLine(result.Text);Dim input As New OcrInput() input.LoadImage("image.png") Dim result As New IronTesseract() With { .Configuration = New TesseractConfiguration With { .WhiteListCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789- " } }.Read(input) Console.WriteLine(result.Text)Dim input As New OcrInput() input.LoadImage("image.png") Dim result As New IronTesseract() With { .Configuration = New TesseractConfiguration With { .WhiteListCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789- " } }.Read(input) Console.WriteLine(result.Text) -
3部署到您的生产环境中进行测试
今天就用免费试用在您的项目中开始使用IronOCR
如何配置 OCR 以实现高级阅读
- 从NuGet安装IronOCR
- 安装IronOcr.Extensions.AdvancedScan包
- 配置
TesseractConfiguration属性,例如WhiteListCharacters和ReadBarCodes - 使用
OcrInput加载输入图像 - 使用
ReadPhoto、ReadLicensePlate或ReadPassport等高级方法读取图像。
Tesseract配置属性
TesseractConfiguration类提供以下用于定制OCR行为的属性。 这些通过IronTesseract.Configuration进行设置。
| 属性 | 翻译类型 | 说明 |
|---|---|---|
WhiteListCharacters | 字符串 | OCR 输出仅识别此字符串中存在的字符,所有其他字符都将被排除。 |
BlackListCharacters | 字符串 | 该字符串中的字符将被主动忽略并从 OCR 输出中删除。 |
ReadBarCodes | 布尔值 | 在 OCR 处理过程中启用或禁用文档中的条形码检测。 |
ReadDataTables | 布尔值 | 使用 Tesseract 启用或禁用文档中的表格结构检测。 |
PageSegmentationMode | TesseractPageSegmentationMode | 决定 Tesseract 如何分割输入图像。选项包括AutoOsd 、 Auto 、 SingleBlock 、 SingleLine 、 SingleWord等。 |
RenderSearchablePdf | 布尔值 | 启用后,OCR 输出可以保存为带有不可见文本层的可搜索 PDF。 |
RenderHocr | 布尔值 | 启用后,OCR 输出将包含 hOCR 数据,以便进一步处理或导出。 |
TesseractVariables | Dictionary<字符串, object> | 提供对低级Tesseract配置变量的直接访问,以进行精细控制。 |
TesseractVariables字典更进一步,提供数百个底层Tesseract引擎参数,以应对高层属性不够用的情况。
以下示例演示了每个属性组,首先是字符白名单。
设置车牌字符白名单
使用WhiteListCharacters的一个常见场景是将OCR输出限制为仅车牌上可能出现的字符:大写字母、数字、连字符和空格。 这样可以消除噪声,提高准确性,方法是告诉引擎忽略预期字符集之外的所有内容。
输入
以下车辆注册记录包含大写文本、小写文本、特殊符号(@、$、#、|、~、^、*)和标点符号。

BlackListCharacters 通过主动排除已知噪声符号(如 ``,~, @, #, $, %, &, and *`)来补充白名单。
using IronOcr;
// Initialize the Tesseract OCR engine
IronTesseract ocr = new IronTesseract();
ocr.Configuration = new TesseractConfiguration
{
// Whitelist only characters that appear on license plates
WhiteListCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789- ",
// Blacklist common noise characters
BlackListCharacters = "`~@#$%&*",
};
var ocrInput = new OcrInput();
// Load the input image
ocrInput.LoadImage("advanced-input.png");
// Perform OCR on the input image with ReadPhoto method
var results = ocr.ReadPhoto(ocrInput);
// Print the filtered text result to the console
Console.WriteLine(results.Text);using IronOcr;
// Initialize the Tesseract OCR engine
IronTesseract ocr = new IronTesseract();
ocr.Configuration = new TesseractConfiguration
{
// Whitelist only characters that appear on license plates
WhiteListCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789- ",
// Blacklist common noise characters
BlackListCharacters = "`~@#$%&*",
};
var ocrInput = new OcrInput();
// Load the input image
ocrInput.LoadImage("advanced-input.png");
// Perform OCR on the input image with ReadPhoto method
var results = ocr.ReadPhoto(ocrInput);
// Print the filtered text result to the console
Console.WriteLine(results.Text);Imports IronOcr
' Initialize the Tesseract OCR engine
Dim ocr As New IronTesseract()
ocr.Configuration = New TesseractConfiguration With {
' Whitelist only characters that appear on license plates
.WhiteListCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789- ",
' Blacklist common noise characters
.BlackListCharacters = "`~@#$%&*"
}
Dim ocrInput As New OcrInput()
' Load the input image
ocrInput.LoadImage("advanced-input.png")
' Perform OCR on the input image with ReadPhoto method
Dim results = ocr.ReadPhoto(ocrInput)
' Print the filtered text result to the console
Console.WriteLine(results.Text)Imports IronOcr
' Initialize the Tesseract OCR engine
Dim ocr As New IronTesseract()
ocr.Configuration = New TesseractConfiguration With {
' Whitelist only characters that appear on license plates
.WhiteListCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789- ",
' Blacklist common noise characters
.BlackListCharacters = "`~@#$%&*"
}
Dim ocrInput As New OcrInput()
' Load the input image
ocrInput.LoadImage("advanced-input.png")
' Perform OCR on the input image with ReadPhoto method
Dim results = ocr.ReadPhoto(ocrInput)
' Print the filtered text result to the console
Console.WriteLine(results.Text)输出

白名单过滤的效果在结果中清晰可见:
- “车牌:ABC-1234”变为“P ABC-1234” 。 小写字母“late:”被省略,而车牌号码则完全保留。
- “VIN: 1HGBH41JXMN109186”变为“VIN 1HGBH41JXMN109186” 。 冒号被省略,但大写的车辆识别码和完整号码被保留。
- “Owner: john.doe@email.com”变为“O” 。 所有小写电子邮件地址和标点符号均被删除。
- "区域:CA-90210 | “5区”变为“R CA-90210 Z 5” 。 管符 (
|) 和井号 (#) 被删除,而大写字母和数字保留。 - “费用:$125.00 + 税*”变为“F 12500” 。 美元符号、小数点、Plus号和小写字母“tax”都被移除。
- "Ref: ~record_v2^final"变为"R 2" 。 波浪号 (
~)、下划线、插入符号 (^) 及所有小写字符都被去除。
相同的 WhiteListCharacters 和 BlackListCharacters 方法适用于任何文档类型,不仅限于车牌。 下一节将展示如何扩展读取操作,以便在同一次读取过程中检测条形码和表格结构。
条形码和数据表读取配置
IronOCR可以检测文档中的条形码、结构化表格以及文本。 这些功能通过TesseractConfiguration来控制:
IronTesseract ocr = new IronTesseract();
ocr.Configuration = new TesseractConfiguration
{
// Enable barcode detection within documents
ReadBarCodes = true,
// Enable table structure detection
ReadDataTables = true,
};IronTesseract ocr = new IronTesseract();
ocr.Configuration = new TesseractConfiguration
{
// Enable barcode detection within documents
ReadBarCodes = true,
// Enable table structure detection
ReadDataTables = true,
};Dim ocr As New IronTesseract()
ocr.Configuration = New TesseractConfiguration With {
.ReadBarCodes = True,
.ReadDataTables = True
}Dim ocr As New IronTesseract()
ocr.Configuration = New TesseractConfiguration With {
.ReadBarCodes = True,
.ReadDataTables = True
}- ReadBarCodes: 设置为
true时,IronOCR会在文档中扫描条形码和文本。 设置为false以跳过条形码检测,并在不期望条形码时加快处理速度。 - ReadDataTables: 设置为
true时,Tesseract尝试检测并保留文档中的表格结构。 这对于发票、报告和其他表格文档非常有用。
这些选项可以与 WhiteListCharacters 和 BlackListCharacters 结合使用,以精确控制从复杂文档中提取的内容。
过滤和检测控制着提取的内容,而布局解释则是另一个需要考虑的问题。 下一节涵盖如何为文档类型选择适合的PageSegmentationMode。
控制页面分段模式
PageSegmentationMode告诉Tesseract在识别之前如何分段输入图像。 为给定布局选择错误的模式会导致引擎误读或完全跳过文本。
| 模式 | 使用案例 |
|---|---|
AutoOsd | 自动版面分析,具备方向和脚本检测功能 |
Auto | 自动布局分析(不带 OSD)(默认) |
SingleColumn | 假设图像为单列文本。 |
SingleBlock | 假设图像是由单个均匀的文本块组成。 |
SingleLine | 假设图像是一行文字。 |
SparseText | 尽可能多地查找文本,顺序不限。 |
对于包含单行的标签或横幅,SingleLine消除了多块分析,并提高了速度和准确性。
输入
single-line-label.png 是一个狭窄的运输标签,只有一行加粗的 Courier 文本:SHIPPING LABEL: TRK-2024-XR9-001。

IronTesseract ocr = new IronTesseract();
ocr.Configuration = new TesseractConfiguration
{
PageSegmentationMode = TesseractPageSegmentationMode.SingleLine,
};
using OcrInput input = new OcrInput();
input.LoadImage("single-line-label.png");
OcrResult result = ocr.Read(input);
Console.WriteLine(result.Text);IronTesseract ocr = new IronTesseract();
ocr.Configuration = new TesseractConfiguration
{
PageSegmentationMode = TesseractPageSegmentationMode.SingleLine,
};
using OcrInput input = new OcrInput();
input.LoadImage("single-line-label.png");
OcrResult result = ocr.Read(input);
Console.WriteLine(result.Text);Imports IronOcr
Dim ocr As New IronTesseract()
ocr.Configuration = New TesseractConfiguration With {
.PageSegmentationMode = TesseractPageSegmentationMode.SingleLine
}
Using input As New OcrInput()
input.LoadImage("single-line-label.png")
Dim result As OcrResult = ocr.Read(input)
Console.WriteLine(result.Text)
End UsingImports IronOcr
Dim ocr As New IronTesseract()
ocr.Configuration = New TesseractConfiguration With {
.PageSegmentationMode = TesseractPageSegmentationMode.SingleLine
}
Using input As New OcrInput()
input.LoadImage("single-line-label.png")
Dim result As OcrResult = ocr.Read(input)
Console.WriteLine(result.Text)
End Using对于文本放置不规则的扫描页,SparseText 比 Auto 恢复更多的内容。
输入
receipt-scan.png是一个Corner Market热敏收据,包含四个项目(咖啡、松饼、果汁、燕麦棒)、虚线分隔符、小计、税和总计。 在这种布局中,固定块分割会遗漏不同水平位置的条目。

IronTesseract ocr = new IronTesseract();
ocr.Configuration = new TesseractConfiguration
{
PageSegmentationMode = TesseractPageSegmentationMode.SparseText,
};
using OcrInput input = new OcrInput();
input.LoadImage("receipt-scan.png");
OcrResult result = ocr.Read(input);
Console.WriteLine(result.Text);IronTesseract ocr = new IronTesseract();
ocr.Configuration = new TesseractConfiguration
{
PageSegmentationMode = TesseractPageSegmentationMode.SparseText,
};
using OcrInput input = new OcrInput();
input.LoadImage("receipt-scan.png");
OcrResult result = ocr.Read(input);
Console.WriteLine(result.Text);Imports IronTesseract
Dim ocr As New IronTesseract()
ocr.Configuration = New TesseractConfiguration With {
.PageSegmentationMode = TesseractPageSegmentationMode.SparseText
}
Using input As New OcrInput()
input.LoadImage("receipt-scan.png")
Dim result As OcrResult = ocr.Read(input)
Console.WriteLine(result.Text)
End UsingImports IronTesseract
Dim ocr As New IronTesseract()
ocr.Configuration = New TesseractConfiguration With {
.PageSegmentationMode = TesseractPageSegmentationMode.SparseText
}
Using input As New OcrInput()
input.LoadImage("receipt-scan.png")
Dim result As OcrResult = ocr.Read(input)
Console.WriteLine(result.Text)
End Using布局分割已根据文档类型进行了调整,下一步是控制下游处理的输出格式。
生成可搜索的 PDF 和 hOCR 输出
RenderSearchablePdf 和 RenderHocr 控制 IronOCR 生成的输出格式,除了纯文本结果。
RenderSearchablePdf在原始图像上嵌入了一个不可见的文本层,生成一个用户可以搜索和复制文本的PDF,同时仍然可见扫描图像。 这是文档归档工作流程的标准输出格式。
输入
scanned-document.pdf是一封来自IronOCR Solutions Ltd.的单页商函(日期为2024年3月15日,参考号DOC-2024-OCR-0315)。 结果保存为searchable-output.pdf。
IronTesseract ocr = new IronTesseract();
ocr.Configuration = new TesseractConfiguration
{
RenderSearchablePdf = true,
};
using OcrInput input = new OcrInput();
input.LoadPdf("scanned-document.pdf");
OcrResult result = ocr.Read(input);
result.SaveAsSearchablePdf("searchable-output.pdf");IronTesseract ocr = new IronTesseract();
ocr.Configuration = new TesseractConfiguration
{
RenderSearchablePdf = true,
};
using OcrInput input = new OcrInput();
input.LoadPdf("scanned-document.pdf");
OcrResult result = ocr.Read(input);
result.SaveAsSearchablePdf("searchable-output.pdf");Imports IronTesseract
Dim ocr As New IronTesseract()
ocr.Configuration = New TesseractConfiguration With {
.RenderSearchablePdf = True
}
Using input As New OcrInput()
input.LoadPdf("scanned-document.pdf")
Dim result As OcrResult = ocr.Read(input)
result.SaveAsSearchablePdf("searchable-output.pdf")
End UsingImports IronTesseract
Dim ocr As New IronTesseract()
ocr.Configuration = New TesseractConfiguration With {
.RenderSearchablePdf = True
}
Using input As New OcrInput()
input.LoadPdf("scanned-document.pdf")
Dim result As OcrResult = ocr.Read(input)
result.SaveAsSearchablePdf("searchable-output.pdf")
End Using输出
输出结果是一个 PDF 文件,它看起来与输入文件完全相同,但其中包含一个隐藏的文本层。 打开searchable-output.pdf并使用Ctrl+F验证嵌入的文本是否可搜索和复制。
RenderHocr生成一个hOCR文档,即一个将文本内容与每个单词的边界框坐标一起编码的HTML文件。 当下游工具需要精确的词语定位时,例如编辑引擎或文档布局分析,这非常有用。
输入
document-page.png是一个文档页面,标题为“2024年第一季度总结”,包含两段关于收入、运营成本和增长驱动因素的财务数据。 结果保存为output.html。

IronTesseract ocr = new IronTesseract();
ocr.Configuration = new TesseractConfiguration
{
RenderHocr = true,
};
using OcrInput input = new OcrInput();
input.LoadImage("document-page.png");
OcrResult result = ocr.Read(input);
result.SaveAsHocrFile("output.html");IronTesseract ocr = new IronTesseract();
ocr.Configuration = new TesseractConfiguration
{
RenderHocr = true,
};
using OcrInput input = new OcrInput();
input.LoadImage("document-page.png");
OcrResult result = ocr.Read(input);
result.SaveAsHocrFile("output.html");Imports IronOcr
Dim ocr As New IronTesseract()
ocr.Configuration = New TesseractConfiguration With {
.RenderHocr = True
}
Using input As New OcrInput()
input.LoadImage("document-page.png")
Dim result As OcrResult = ocr.Read(input)
result.SaveAsHocrFile("output.html")
End UsingImports IronOcr
Dim ocr As New IronTesseract()
ocr.Configuration = New TesseractConfiguration With {
.RenderHocr = True
}
Using input As New OcrInput()
input.LoadImage("document-page.png")
Dim result As OcrResult = ocr.Read(input)
result.SaveAsHocrFile("output.html")
End Using输出
output.html将每个识别的单词编码为其边界框坐标。 在浏览器中打开文件以检查 hOCR 结构,或将其传递给下游工具进行布局分析或编辑。
如果您需要从单个读取调用中获得所有三种输出格式(纯文本、可搜索 PDF 和 hOCR),则可以同时启用这两个标志。
这些输出标志与读取的语言无关,包括非拉丁字母。下一节将介绍如何对日语文本应用字符过滤。
国际文档的Unicode字符过滤
对于中文、日文或韩文的国际文档,WhiteListCharacters 和 BlackListCharacters 属性与 Unicode 字符一起工作。 这样可以将输出限制为特定脚本,例如日语仅输出平假名和片假名。
输入
该文档包含标题 (テsuto)、混合平假名和片假名以及浊音变体 (プ、で) 的日语句子、包含列入黑名单的噪音符号 (★、■) 和汉字 (価格) 的价格线、包含另一个列入黑名单的符号 (§) 的备注行、更多汉字 (购入)、其他浊音标记变体 (プ、デ) 和基本片假名(メモ,ール)。 白名单仅允许平假名、片假名、数字和常用日语标点符号通过; 这三个噪声符号已被明确列入黑名单。

Hiragana 和 Katakana 的 Unicode 字符范围是以字符串字面量形式传递到 WhiteListCharacters 中,噪声符号列在 BlackListCharacters 中。
using IronOcr;
using System.IO;
IronTesseract ocr = new IronTesseract();
ocr.Configuration = new TesseractConfiguration
{
// Whitelist only Hiragana, Katakana, numbers, and common Japanese punctuation
WhiteListCharacters = "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん" +
"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲン" +
"0123456789、。?!()¥ー",
// Blacklist common noise/symbols you want to ignore
BlackListCharacters = "★■§",
};
var ocrInput = new OcrInput();
// Load Japanese input image
ocrInput.LoadImage("jp.png");
// Perform OCR on the input image with ReadPhoto method
var results = ocr.ReadPhoto(ocrInput);
// Write the text result directly to a file named "output.txt"
File.WriteAllText("output.txt", results.Text);
// You can add this line to confirm the file was saved:
Console.WriteLine("OCR results saved to output.txt");using IronOcr;
using System.IO;
IronTesseract ocr = new IronTesseract();
ocr.Configuration = new TesseractConfiguration
{
// Whitelist only Hiragana, Katakana, numbers, and common Japanese punctuation
WhiteListCharacters = "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん" +
"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲン" +
"0123456789、。?!()¥ー",
// Blacklist common noise/symbols you want to ignore
BlackListCharacters = "★■§",
};
var ocrInput = new OcrInput();
// Load Japanese input image
ocrInput.LoadImage("jp.png");
// Perform OCR on the input image with ReadPhoto method
var results = ocr.ReadPhoto(ocrInput);
// Write the text result directly to a file named "output.txt"
File.WriteAllText("output.txt", results.Text);
// You can add this line to confirm the file was saved:
Console.WriteLine("OCR results saved to output.txt");Imports IronOcr
Imports System.IO
Dim ocr As New IronTesseract()
ocr.Configuration = New TesseractConfiguration With {
.WhiteListCharacters = "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん" &
"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲン" &
"0123456789、。?!()¥ー",
.BlackListCharacters = "★■§"
}
Dim ocrInput As New OcrInput()
' Load Japanese input image
ocrInput.LoadImage("jp.png")
' Perform OCR on the input image with ReadPhoto method
Dim results = ocr.ReadPhoto(ocrInput)
' Write the text result directly to a file named "output.txt"
File.WriteAllText("output.txt", results.Text)
' You can add this line to confirm the file was saved:
Console.WriteLine("OCR results saved to output.txt")Imports IronOcr
Imports System.IO
Dim ocr As New IronTesseract()
ocr.Configuration = New TesseractConfiguration With {
.WhiteListCharacters = "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん" &
"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲン" &
"0123456789、。?!()¥ー",
.BlackListCharacters = "★■§"
}
Dim ocrInput As New OcrInput()
' Load Japanese input image
ocrInput.LoadImage("jp.png")
' Perform OCR on the input image with ReadPhoto method
Dim results = ocr.ReadPhoto(ocrInput)
' Write the text result directly to a file named "output.txt"
File.WriteAllText("output.txt", results.Text)
' You can add this line to confirm the file was saved:
Console.WriteLine("OCR results saved to output.txt")输出

完整的过滤输出可作为文本文件提供:jp-output.txt。
因为白名单只包含基本的平假名和片假名字符,所以像プ(pu)和デ(de)这样的派生声标变体被删除了。 像価格(价格)和購入(购买)这样的汉字也被排除在外,因为它们不在白名单字符集中。 无论白名单如何,像 ★、■ 和 § 这样的黑名单符号都会被积极移除。
接下来我该去哪里?
现在您已经了解如何配置IronOCR以适应高级阅读场景,请探索以下内容:
- 读取特定文档类型,如护照和车牌
- 作为独立OCR用例的条码和二维码读取
- 从处理结果中导出hOCR和可搜索PDF
对于生产使用,请记得获取许可证来去除水印并访问完整的功能。
常见问题
如何使用IronOCR限制OCR输出为特定字符?
在IronOCR中,您可以使用TesseractConfiguration的WhiteListCharacters属性,将OCR输出限制为特定字符。这允许您仅限制识别白名单中的字符,从而减少噪声并提高准确性。
IronOCR中的`BlackListCharacters`功能有什么用途?
IronOCR中的BlackListCharacters属性允许您积极忽略和移除OCR输出中的特定字符。这对于从识别过程中排除已知噪声符号非常有用。
如何在IronOCR中启用条码和数据表读取?
要在IronOCR中启用条码和数据表读取,在TesseractConfiguration中将ReadBarCodes和ReadDataTables属性设置为true。这样将允许OCR引擎检测文档中的条码和表格结构。
`PageSegmentationMode`是什么,它如何影响OCR处理?
IronOCR中的PageSegmentationMode决定了Tesseract在文本识别之前如何分割输入图像。不同的模式如SingleLine或SparseText可以优化OCR以适应不同的布局,比如单行标签或不规则文本排列的复杂页面。
IronOCR可以生成可搜索的PDF吗?
可以,通过在TesseractConfiguration中将RenderSearchablePdf设置为true,IronOCR可以生成可搜索的PDF。这会创建一个在原始图像上带有不可见文本层的PDF,启用文本搜索和复制功能。
IronOCR中的hOCR输出是什么?
IronOCR中的hOCR输出是一种HTML格式,它为每个单词编码了带有边界框坐标的文本内容。通过将RenderHocr设置为true,可以在HTML中实现精确的单词定位,以便于后续处理。
如何使用IronOCR对国际文档进行OCR处理?
IronOCR通过允许Unicode字符过滤来处理国际文档。您可以使用Unicode字符设置WhiteListCharacters和BlackListCharacters来控制识别哪些书写系统和符号,从而确保诸如中文、日文和韩文等语言的准确处理。
在IronOCR中配置`TesseractConfiguration`有什么好处?
在IronOCR中配置TesseractConfiguration允许开发人员通过字符白名单/黑名单、条码检测、表格结构读取和页面分割模式等选项微调OCR处理,在各种文档类型中实现高级读取场景。
IronOCR能识别含有多种语言的图像中的文本吗?
通过配置WhiteListCharacters以包含所需书写系统的字符,IronOCR可以识别含有多种语言的图像中的文本。安装合适的语言包,如IronOcr.Languages.Japanese,也确保了最佳的识别结果。
IronOCR如何处理不在白名单上的字符?
在IronOCR中,不在WhiteListCharacters属性中的字符会在OCR输出中被静默删除。此功能有助于消除不必要的噪声,并将注意力集中在相关字符集的识别上。
Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。