LEADTOOLS 18 的多平台 OCR





0/5 (0投票)
使用 LEADTOOLS 18 的多平台 OCR。
引言
随着 LEADTOOLS 18 版本的发布,也被称为 LEADTOOLS Anywhere™,LEAD Technologies 通过为 iOS、OS X、Android 和 Linux 提供新的多平台图像处理库,扩展了其作为世界领先的图像处理 SDK 的影响力。查看器、注释和标记、OCR、条形码、PDF、图像格式、压缩、图像处理等等,仅仅是 LEADTOOLS 可以为任何开发人员提供的功能的一小部分,而不仅仅是那些面向 Windows 的开发人员。
使用 LEADTOOLS 的程序员可以在每个开发平台上体验到一组非常相似的库。对于那些目标是在多个平台上创建其应用程序的本地版本的开发人员来说,这是一个明显的优势。即使您的计划是为单个平台开发,LEADTOOLS 也为每个主要平台提供了一个程序员友好的界面,以及轻松扩展到未来的灵活性和安心感。
LEADTOOLS Anywhere™ SDK 中的主要特性
- 专门为 .NET、HTML5、WinRT、iOS、OS X 和 Android 设计的图像查看器控件
- 加载、转换和保存 150 多种图像格式
- 对常见格式(包括 PDF、PDF/A、JPEG、JPEG 2000、TIFF、JBIG2 等)的高级位深度、色彩空间和压缩支持
- OCR 将图像转换为可搜索的文本、PDF 和 DOC
- QR、PDF417、Data Matrix、UPC/EAN 等的条形码读取和写入
- 全面的注释和标记,包括几何形状、便笺、编辑、突出显示和图章
- 200 多个图像处理功能,用于增强、校正和操作图像
OCR 代码
在下面的例子中,我们将展示如何将平台原生图像转换为 LEADTOOLS RasterImage
,然后使用 OCR 引擎提取可搜索的文本。另外,开发人员可以使用 RasterCodecs
对象来加载和保存他们的图像。然而,使用 LEAD 的转换实用程序是现有应用程序的一个强大资产,因为它只需要对您当前的代码库进行最小的更改。
.NET
System.Drawing.Bitmap bitmap = ... //
// Get a LEADTOOLS RasterImage from the platform image
RasterImage rasterImage = RasterImageConverter.FromImage(bitmap);
// Create a LEADTOOLS OCR Document instance
IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineAdvantage, false);
ocrEngine.Startup(null, null, null, Application.CommonAppDataPath);
IOcrDocument ocrDocument = ocrEngine.DocumentManager.CreateDocument();
// Add the page to the document and recognize it
IOcrPage ocrPage = ocrDocument.Pages.AddPage(rasterImage, null);
// Recognize the image as text
string text = ocrPage.RecognizeText(null);
// Do something with 'text'
WinRT
Windows.UI.Xaml.Media.ImageSource imageSource = ... //
// Get a LEADTOOLS RasterImage from the platform image
RasterImage rasterImage = RasterImageConverter.ConvertFromImageSource(imageSource, ConvertFromImageOptions.None);
// Create a LEADTOOLS OCR Document instance
IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false);
ocrEngine.Startup(null, null, string.Empty, Package.Current.InstalledLocation.Path);
IOcrDocument ocrDocument = ocrEngine.DocumentManager.CreateDocument();
// Add the page to the document and recognize it
IOcrPage ocrPage = ocrDocument.Pages.AddPage(rasterImage, null);
// Recognize the image as text
string text = ocrPage.RecognizeText(null);
// Do something with 'text'
iOS & OS X
UIImage* uiImage = ... // // Get a LEADTOOLS RasterImage from the platform image LTRasterImage* rasterImage = [LTRasterImageConverter convertFromImage:uiImage options:LTConvertFromImageOptions_None error:nil]; // Create a LEADTOOLS OCR Document instance [ocrEngine startup:nil workDirectory:nil startupParameters:[[NSBundle mainBundle] bundlePath]; LTOcrDocument* ocrDocument = [ocrEngine.documentManager createDocument]; // Add the page to the document and recognize it LTOcrPage* ocrPage = [ocrDocument.pages addPageWithImage:rasterImage target:nil selector:nil error:nil]; // Recognize the image as text NSString* text = [ocrPage recognizeText:nil selector:nil error:nil]; // Do something with 'text'
Android
android.graphics.Bitmap bitmap = ... //
// Get a LEADTOOLS RasterImage from the platform image
RasterImage rasterImage = RasterImageConverter.convertFromBitmap(bitmap, ConvertFromImageOptions.NONE);
// Create a LEADTOOLS OCR Document instance
OcrEngine ocrEngine = OcrEngineManager.createEngine(OcrEngineType.Advantage);
ocrEngine.startup(null, "", null, this.getApplicationInfo().dataDir);
OcrDocument document = ocrEngine.getDocumentManager().createDocument();
// Add the page to the document and recognize it
OcrPage ocrPage = document.getPages().addPage(image, null);
// Recognize the image as text
String text = ocrPage.recognizeText(this);
// Do something with 'text'
下载完整示例
您可以下载包含上述功能的完整功能演示。 要运行这些示例,您需要以下内容
- LEADTOOLS V18(免费 60 天评估版)
- 浏览到 LEADTOOLS 示例文件夹(例如C:\LEADTOOLS 18\Examples\),您将找到每个开发平台的所有示例项目
支持
需要帮助才能启动并运行此示例吗?联系我们的支持团队以获得免费技术支持! 如有定价或许可问题,您可以联系我们的销售团队 (sales@leadtools.com) 或致电 704-332-5532。