C # Graphic Recognition

Source: Internet
Author: User

I mainly used to identify the text on the video, but the graphics and text recognition technology is not mature enough to identify more difficult, some simple page can be identified.

In this paper, we introduce two kinds of popular and mature recognition methods:

Way one, ASPRISE-OCR realization.

Way two, Microsoft office Document Imaging (Office 2007) components are implemented.

Method one, ASPRISE-OCR use.

ASPRISE-OCR:

Http://asprise.com/product/ocr/download.php?lang=csharp  

The 3 DLLs that need to be used are AspriseOCR.dll, DevIL.dll, ILU.dll.

It is important to note that these several. dll is the VC write reference to be used in the program with DllImport reference, the key code:

[DllImport ("AspriseOCR.dll", EntryPoint = "OCR", CallingConvention = callingconvention.cdecl)]

public static extern IntPtr OCR (string file, int type);

[DllImport ("AspriseOCR.dll", EntryPoint = "Ocrpart", CallingConvention = callingconvention.cdecl)]

static extern IntPtr Ocrpart (string file, int type, int startX, int starty, int width, int height);

[DllImport ("AspriseOCR.dll", EntryPoint = "Ocrbarcodes", CallingConvention = callingconvention.cdecl)]

static extern IntPtr ocrbarcodes (string file, int type);

[DllImport ("AspriseOCR.dll", EntryPoint = "Ocrpartbarcodes", CallingConvention = callingconvention.cdecl)]

static extern IntPtr ocrpartbarcodes (string file, int type, int startX, int starty, int width, int height);

The calling code is simply one sentence:

MessageBox.Show (Marshal.ptrtostringansi (Ocrpart (Img_path,-1, StartX, starty, width, height)));

Where Img_path: For the picture path, StartX, starty coordinates are 0, width, height picture width and height.

Way two, Microsoft office Document Imaging (Office 2007) components are implemented.

Before using the imaging component compatibility is not very good, the use of Win 7 Office 2007 must be on the office of the SP1 or SP2 patch, read Chinese only line.

SP1 patch address (226M):

http://download.microsoft.com/download/1/6/5/1659d607-8696-4001-8072-efaedd70dd30/ Office2007sp1-kb936982-fullfile-zh-cn.exe

SP2 patch address (301 MB):

http://download.microsoft.com/download/A/3/9/A39E919E-AFA8-4128-9249-51629206C70F/ Office2007sp2-kb953195-fullfile-zh-cn.exe

Add a component reference to the project,

Using code:

MODI. Document doc = new MODI. Document ();

Doc. Create (Img_path);

MODI. Image Image;

MODI. Layout layout;

Doc.  OCR (MODI.MiLANGUAGES.miLANG_CHINESE_SIMPLIFIED, True, true); Identify Simplified Chinese

for (int i = 0; i < Doc. Images.count; i++)

{

Image = (MODI. Image) Doc. Images[i];

Layout = image. Layout;

Sb. Append (layout. Text);

}

MessageBox.Show (sb.) ToString ());

Where Img_path is the picture path, Modi.milanguages is the text type enumeration that reads the picture.

This article source:Http://files.cnblogs.com/stone_w/OCR.rar

C # Graphic Recognition

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.