tesseract Series (2) - the use of tesseract

Say how compiled into a library above, this time to talk about how to use, to verify the results compiled out.

The figure is generated debug file, which has a tesseract applications.

 

 

 

       cmd into the directory, execute the command: tesseract eurotext.tif euro   

 

      eurotext.tif is the current directory to identify the picture, tif format is a picture, not before contacting tesseract, I never heard of such a format, or specially Baidu, and I really could dish.

      After executing the command, it generates a euro .txt files in the current directory, which is identified content.

 

      New vs engineering, the tiff libraries and header files, as well as leptonica libraries and header files are added to the project.

      If you are using method 2, it may be very easy to find these files, if the method is how to do it?

      

      First, let me leptonica:

      Because we are cppan use of automatic download, so I do not know what is kept in place, but according to my tests, different computers, storage location are not the same, to tell you a chicken thief particular way:

     leptonica header file has a name that is arrayaccess.h header files. Download and install everything (software an automatic search, Baidu will not it, very simple)

     Search arrayaccess.h file with the following results:

      

 

 

       On the right, open the path to extract all of the .h header file is completed.

       Find dll and lib when searching anbloomberg.leptonica, various libraries have, ah

     

 

 

 

      Below find the tiff library:

       

 

 

 

      Remember, generally in the C disk to use \ .cppan \ directory, anyway, very good looking, the name of the library are the same, the number is the version number of the library.

      

      Header Search ccmain, then the header files in these folders are required:

   

 

 

     Or do you have your own simple way to use ah, I just find myself a little bit blind, anyway quite some doing.

 

     Libraries have done by now, it is to write the following code.

    

#include "baseapi.h"
#include "allheaders.h"
 
int main ()
{
	char *outText;
	tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
	if (api->Init(“E:\\tessdata“”, "eng"))
	{
		exit(1);
	}
 
	Pix *image = pixRead("./eurotext.tif");
	outText = api->GetUTF8Text();
	delete[] outText;
	pixDestroy(&image);
	return 0;
}

  

   Note ah: 

IF (API-> the Init ( "E: \\ tessdata" "," ENG ")) 

the init time here to add data sets and models, I downloaded the installation package tesseract, found in the installation directory comes training model, tessdata file pieces, and then the path to the folder is written on the inside of init.

ran through the recording began, thanks to memories, some places are not very careful.

  

  

 

Guess you like

Origin www.cnblogs.com/132818Creator/p/11818843.html