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