原創(chuàng)|產(chǎn)品更新|編輯:李顯亮|2020-06-18 09:54:00.507|閱讀 363 次
概述:Aspose.OCR for .NET更新至最新版v20.6,添加了對使用流的API支持,添加了指定字符以進(jìn)行識(shí)別的功能,改善了識(shí)別質(zhì)量,歡迎下載體驗(yàn)。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Aspose.OCR for .NET是一款字符識(shí)別組件,它使得開發(fā)人員可以添加OCR功能到他們的ASP.NET Web應(yīng)用程序、web服務(wù)和windows應(yīng)用程序中。它提供了一個(gè)簡單的類集用于控制字符識(shí)別。
Aspose.OCR for .NET迎來2020年v20.6最新版更新,添加了對使用流的API支持,添加了指定字符以進(jìn)行識(shí)別的功能,改善了識(shí)別質(zhì)量。(點(diǎn)擊下方按鈕即可下載)
space | ! | " | # | $ | % | & | ' | ( | ) |
* | + | , | - | . | / | 0 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = |
---|---|---|---|---|---|---|---|---|---|
> | ? | @ | [ | \ | ] | _ | ` | { | | |
} | ~ | A | B | C | D | E | F | G | H |
I | J | K | L | M | N | O | P | Q | R |
S | T | U | V | W | X | Y | Z | a | b |
c | d | e | f | g | h | i | j | k | l |
m | n | o | p | q | r | s | t | u | v |
w | x | y | z | ? | à | á | ? | ? | ? |
? | è | é | ê | ? | ì | í | ? | ? | ? |
ò | ó | ? | ? | ? | ù | ú | ? | ü | ? |
? | à | á | a | ? | ? | ? | ? | è | é |
ê | ? | ì | í | ? | ? | ? | ò | ó | ? |
? | ? | ù | ú | ? | ü | ? | ? | ? | ? |
方法
|
描述
|
---|---|
string RecognizeImage(MemoryStream stream) | 通過自動(dòng)檢測文本區(qū)域來識(shí)別圖像,并檢測,糾正文本偏斜。支持GIF,PNG,JPEG,BMP,TIFF和WBMP。stream-圖像的MemoryStream。 |
string RecognizeImage(string fullPath) | 通過自動(dòng)檢測文本區(qū)域來識(shí)別圖像,并檢測,糾正文本偏斜。支持GIF,PNG,JPEG,BMP,TIFF和WBMP。fullPath-圖像的路徑。 |
List RecognizeImage(MemoryStream stream, List rects) | 識(shí)別指定矩形中的文本。支持GIF,PNG,JPEG,BMP,TIFF和WBMP。不會(huì)發(fā)生歪斜對齊。stream-圖像的MemoryStream。rects-用于識(shí)別的以像素為單位的矩形列表。 |
string RecognizeImage(MemoryStream stream, Rectangle rects) | 識(shí)別指定矩形中的文本。支持GIF,PNG,JPEG,BMP,TIFF和WBMP。不會(huì)發(fā)生歪斜對齊。stream-圖像的MemoryStream。rects-以像素為單位的矩形,用于識(shí)別。 |
List RecognizeImage(string fullPath, List rects) | 識(shí)別指定矩形中的文本。支持GIF,PNG,JPEG,BMP,TIFF和WBMP。不會(huì)發(fā)生歪斜對齊。fullPath-圖像的路徑。rects-用于識(shí)別的以像素為單位的矩形列表。 |
string RecognizeImage(string fullPath, Rectangle rects) | 識(shí)別指定矩形中的文本。支持GIF,PNG,JPEG,BMP,TIFF和WBMP。不會(huì)發(fā)生歪斜對齊。fullPath-圖像的路徑。rects-以像素為單位的矩形,用于識(shí)別。 |
string RecognizeImage(MemoryStream stream, bool detectAreas, bool autoSkew = true) | 識(shí)別帶有或不帶有自動(dòng)檢測文本區(qū)域的圖像,并根據(jù)參數(shù)校正文本的偏斜。支持GIF,PNG,JPEG,BMP,TIFF和WBMP。stream-圖像的MemoryStream。detectAreas-自動(dòng)檢測文本區(qū)域。如果為假,則圖像被視為一個(gè)文本塊。autoSkew-刪除歪斜圖像。默認(rèn)值-true。 |
string RecognizeImage(string fullPath, bool detectAreas, bool autoSkew = true) | 識(shí)別帶有或不帶有自動(dòng)檢測文本區(qū)域的圖像,并根據(jù)參數(shù)校正文本的偏斜。支持GIF,PNG,JPEG,BMP,TIFF和WBMP。fullPath-圖像的路徑。detectAreas-自動(dòng)檢測文本區(qū)域。如果為假,則圖像被視為一個(gè)文本塊。autoSkew-刪除歪斜圖像。默認(rèn)值-true。 |
string RecognizeLine(MemoryStream stream) | 識(shí)別僅包含一行文本的圖像。不會(huì)發(fā)生歪斜對齊。支持GIF,PNG,JPEG,BMP,TIFF和WBMP。stream-圖像的MemoryStream。 |
string RecognizeLine(string fullPath) | 識(shí)別僅包含一行文本的圖像。不會(huì)發(fā)生歪斜對齊。支持GIF,PNG,JPEG,BMP,TIFF和WBMP。fullPath-圖像的路徑。 |
float CalculateSkew(MemoryStream image) | 計(jì)算圖像中文本的傾斜角(以度為單位)。image-圖像的MemoryStream。 |
float CalculateSkew(string fullPath) | 計(jì)算圖像中文本的傾斜角(以度為單位)。fullPath-圖像的路徑。 |
List GetRectangles(MemoryStream stream) | 獲取帶有文本區(qū)域的檢測矩形。不會(huì)發(fā)生歪斜對齊。支持GIF,PNG,JPEG,BMP,TIFF和WBMP。stream-圖像的MemoryStream。 |
List GetRectangles(string fullPath) | 獲取帶有文本區(qū)域的檢測矩形。不會(huì)發(fā)生歪斜對齊。支持GIF,PNG,JPEG,BMP,TIFF和WBMP。fullPath-圖像的路徑 |
License() | 構(gòu)造函數(shù)。創(chuàng)建一個(gè)許可證實(shí)例。 |
AsposeOcr(string alphabet) | 構(gòu)造函數(shù)。創(chuàng)建一個(gè)API實(shí)例,并在字母表中設(shè)置允許的字符集。 |
AsposeOCR() | 構(gòu)造函數(shù)。創(chuàng)建一個(gè)API實(shí)例。 |
void SetLicense(string licenseName) | licenseName-xml許可證文件的路徑。 |
using System; using System.Collections.Generic; using System.Drawing; using System.IO; using Aspose.OCR; namespace ProgramOCR { class Program { static void Main(string[] args) { // Get API AsposeOcr api = new AsposeOcr(); // Create license License lic = new License(); // Set license lic.SetLicense("Aspose.Total.lic"); // Get image for recognize string imgPath = "test_ocr.png"; /* Recognize image from file*/ // Recognize image string result = api.RecognizeImage(imgPath); // Print result Console.WriteLine(result); /* Recognize image from stream*/ using (MemoryStream ms = new MemoryStream()) using (FileStream file = new FileStream(imgPath, FileMode.Open, FileAccess.Read)) { file.CopyTo(ms); result = api.RecognizeImage(ms); } Console.WriteLine(result); /*Recognize image from file without detected texts areas and remove skew (all image is a text area) */ result = api.RecognizeImage(imgPath, false); Console.WriteLine(result); /*Recognize image from file with detected texts areas and without remove skew text*/ result = api.RecognizeImage(imgPath, true, false); Console.WriteLine(result); /* Recognize image in the specified rectangles */ List<Rectangle> rects = new List<Rectangle>() { new Rectangle(138, 352, 2033, 537), new Rectangle(147, 890, 2033, 1157), new Rectangle(923, 2045, 465, 102), new Rectangle(104, 2147, 2076, 819) }; List<string> listResult = api.RecognizeImage(imgPath, rects); foreach (string s in listResult) { Console.WriteLine(s); } /* Recognize image in the specified rectangle */ result = api.RecognizeImage(imgPath, rects[0]); Console.WriteLine(result); /* With allowed symbols*/ // Create api instance with allowed symbols. api = new AsposeOcr("0123456789"); // Get image line for recognize imgPath = "0002240177.Jpeg"; // Recognize line result = api.RecognizeLine(imgPath); Console.WriteLine(result); /* Calculate skew image from stream */ imgPath = "skew_image.png"; float angle = 0; using (MemoryStream ms = new MemoryStream()) using (FileStream file = new FileStream(imgPath, FileMode.Open, FileAccess.Read)) { file.CopyTo(ms); angle = api.CalculateSkew(ms); } Console.WriteLine(angle); /* Calculate skew image from path to image */ angle = api.CalculateSkew(imgPath); Console.WriteLine(angle); } } }
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn