原創|使用教程|編輯:郝浩|2013-02-21 11:07:39.000|閱讀 1121 次
概述:LEADTOOLS最近發布了v18版本,他將世界最領先的成像技術擴展到iOS,Android和Linux OS X等平臺。本文展示LEADTOOLS對于各個平臺不同的OCR代碼示例。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
LEADTOOLS最近發布了v18版本,這個版本也被稱為LEADTOOLS Anywhere™,他將世界最領先的成像技術擴展到iOS,Android和Linux OS X等平臺。不僅僅是Windows平臺,他讓所有流行的平臺都能夠實現查看者,注釋和標記,OCR,條碼,PDF,圖像格式,壓縮,圖像處理等更多圖像OCR功能。
每個使用LEADTOOLS的開發者能夠在每個開發平臺上使用一組非常相似的庫進行程序開發。這是其的一個明顯優勢,讓開發者即能夠開發原生的應用程序,又不用花費太多的時間進行完全的代碼重寫。
接下來,我們將展示LEADTOOLS對于各個平臺不同的OCR代碼示例。
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'
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'
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.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'
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網