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