#include "mfcpch.h"
#include "applybox.h"
#include "control.h"
#include "tessvars.h"
#include "tessedit.h"
#include "baseapi.h"
#include "pageres.h"
#include "imgs.h"
#include "varabled.h"
#include "tprintf.h"
#include "tesseractmain.h"
#include "stderr.h"
#include "notdll.h"
#include "mainblk.h"
#include "globals.h"
#include "tfacep.h"
#include "callnet.h"
Go to the source code of this file.
#define API_CONFIG "configs/api_config" |
#define EXTERN |
Definition at line 73 of file tesseractmain.cpp.
#define VARDIR "configs/" |
Variables files.
* (C) Copyright 1992, Hewlett-Packard Ltd. ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** http://www.apache.org/licenses/LICENSE-2.0 ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License.
Definition at line 69 of file tesseractmain.cpp.
int main | ( | int | argc, | |
char ** | argv | |||
) |
Create files "tessdata/inttemp" and "tessdata/pffmtable" from feature samples in training pageS.
Definition at line 95 of file tesseractmain.cpp.
00095 { 00096 STRING outfile; //output file 00097 00098 if (argc < 3) { 00099 USAGE.error (argv[0], EXIT, 00100 "%s imagename outputbase [configfile [[+|-]varfile]...]\n", argv[0]); 00101 } 00102 00103 if (argc == 3) 00104 TessBaseAPI::Init(argv[0], argv[1], NULL, false, 0, argv + 2); 00105 else 00106 TessBaseAPI::Init(argv[0], argv[1], argv[3], false, argc - 4, argv + 4); 00107 00108 tprintf ("Tesseract Open Source OCR Engine\n"); 00109 00110 IMAGE image; 00111 #ifdef _TIFFIO_ 00112 TIFF* tif = TIFFOpen(argv[1], "r"); 00113 if (tif) { 00114 read_tiff_image(tif, &image); 00115 TIFFClose(tif); 00116 } else { 00117 READFAILED.error (argv[0], EXIT, argv[1]); 00118 } 00119 #else 00120 if (image.read_header(argv[1]) < 0) 00121 READFAILED.error (argv[0], EXIT, argv[1]); 00122 if (image.read(image.get_ysize ()) < 0) { 00123 MEMORY_OUT.error(argv[0], EXIT, "Read of image %s", 00124 argv[1]); 00125 } 00126 #endif // _TIFFIO_ 00127 int bytes_per_line = check_legal_image_size(image.get_xsize(), 00128 image.get_ysize(), 00129 image.get_bpp()); 00130 char* text = TessBaseAPI::TesseractRect(image.get_buffer(), image.get_bpp()/8, 00131 bytes_per_line, 0, 0, 00132 image.get_xsize(), image.get_ysize()); 00133 outfile = argv[2]; 00134 outfile += ".txt"; 00135 FILE* fp = fopen(outfile.string(), "w"); 00136 if (fp != NULL) { 00137 fwrite(text, 1, strlen(text), fp); 00138 fclose(fp); 00139 } 00140 delete [] text; 00141 TessBaseAPI::End(); 00142 00143 return 0; //Normal exit 00144 }
int initialized = 0 |
Definition at line 202 of file tesseractmain.cpp.
int NO_BLOCK |
Definition at line 53 of file output.cpp.
char szAppName[] = "Tessedit" |
Definition at line 86 of file tesseractmain.cpp.