Multi-Platform OCR with LEADTOOLS 18





0/5 (0 vote)
Multi-Platform OCR with LEADTOOLS 18.
Introduction
With the release of LEADTOOLS Version 18, also known as LEADTOOLS Anywhere™, LEAD Technologies has expanded its reach as the world’s leading imaging SDK by providing new multi-platform imaging libraries for iOS, OS X, Android and Linux. Viewers, annotations and markups, OCR, barcode, PDF, image formats, compression, image processing and more are just a sampling of what LEADTOOLS has to offer any developer, not just those targeting Windows.
Programmers using LEADTOOLS can experience a set of libraries that closely resemble each other on every development platform. This is a distinct advantage for developers whose goal is to create native versions of their apps on multiple platforms. Even if your plan is to develop for a single platform, LEADTOOLS provides a programmer friendly interface for every major platform out there, and the flexibility and peace of mind to easily expand in the future.
Key Features in LEADTOOLS Anywhere™ SDKs
- Image Viewer Controls designed specifically for .NET, HTML5, WinRT, iOS, OS X and Android
- Load, convert and save more than 150 image formats
- Advanced bit depth, color space and compression support for common formats including PDF, PDF/A, JPEG, JPEG 2000, TIFF, JBIG2 and more
- OCR to convert images to searchable text, PDF and DOC
- Barcode reading and writing for QR, PDF417, Data Matrix, UPC/EAN and more
- Comprehensive Annotation and Markup including geometric shapes, sticky note, redact, highlight and rubber stamp
- Over 200 Image processing functions for enhancing, correcting and manipulating images
The OCR Code
In the examples that follow, we’ll show how to convert a
platform-native image into a LEADTOOLS RasterImage
, and
then use the OCR engine to extract the searchable text. Alternatively,
developers can use the RasterCodecs
object to load and
save their images. However, using LEAD’s conversion utilities is a powerful
asset for existing applications because it requires minimal changes to your
current code base.
.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'
Download the Full Examples
You can download fully functional demos which includes the features discussed above. To run these examples you will need the following:
- LEADTOOLS V18 (free 60 day evaluation)
- Browse to the LEADTOOLS Examples folder (e.g. C:\LEADTOOLS 18\Examples\) and you will find all of the example projects for each development platform
Support
Need help getting this sample up and going? Contact our support team for free technical support! For pricing or licensing questions, you can contact our sales team (sales@leadtools.com) or call us at 704-332-5532.