C + + call Asprise OCR recognition picture

Source: Internet
Author: User

In a recognition software found Asprise OCR "Figure", the last officer network to check the relevant information, found that the function is very powerful, the identification of the printed body should be good, unfortunately it seems not to recognize Chinese, but do not know how it is distorted after the English recognition ability, otherwise it can be used to identify the verification code. Download the C + + demo on the website and record it here.

1. Preparation

Download the C + + DLL and header files on the website, create a Win32 project using VS2010, copy the downloaded DLLs and files to the created project directory.

2. Code
#include <iostream>#include"asprise_ocr_api.h"using namespacestd;voidTESTOCR () {Const Char* Libfolder =".";//Modify the directory where the DLL is located, here. Represents the current directory    Const Char* Fileimg ="Test.png";//Modify the image directory that needs to be identified,//Load DLLLibrary_handle Libhandle =dynamic_load_aocr_library (Libfolder); //output version information for current OCRcout <<"Version:"<< c_com_asprise_ocr_version () <<Endl; intSetup = C_com_asprise_ocr_setup (false); if(Setup! =1) {Cerr<<"Failed to setup. Code:"<< Setup <<Endl; return; }    //Must be of a long long type    Long LongPtrtoapi = C_com_asprise_ocr_start ("Eng", ocr_speed_fast, NULL, NULL, or NULL); //Setting Identification Parameters    if(Ptrtoapi = =0) {Cerr<<"Failed to start."<<Endl; return; } cout<<"OCR engine started."<<Endl; //start recognition, ocr_output_format_pdf indicates that the output is a PDF file, Prop_pdf_output_file is a file name,//prop_pdf_output_text_visible Indicates whether text is displayed above the original picture    Char* s = c_com_asprise_ocr_recognize (Ptrtoapi, Fileimg,-1, -1, -1, -1, -1, Ocr_recognize_type_all, Ocr_output_format_pdf,"Prop_pdf_output_file=result.pdf,prop_pdf_output_text_visible=true,prop_pdf_output_image_force_bw=true,prop _output_separate_words=false,prop_pdf_output_return_text=text",",","="); cout<<"returned:"<< s <<Std::endl; //Closec_com_asprise_ocr_stop (PTRTOAPI); //Uninstalling DLLscout <<"Unload:"<< (Dynamic_unload_aocr_library (libhandle)?"OK":"Failed") <<Endl;}int_tmain (intARGC, _tchar*argv[])    {TESTOCR (); Std::cout<<"Press ENTER to exit:";    Std::cin.ignore (); return 0;}
3. Result original picture (image format):

After the document is recognized PDF:

4. Related Downloads

Go to csdn download

5. End

C + + call Asprise OCR recognition picture

Related Article

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.