Fixed compilation with GRAPHICS_DISABLED

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@250 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
theraysmith 2009-06-03 17:24:08 +00:00
parent c2ca19e073
commit bea5e04b76
25 changed files with 64 additions and 98 deletions

View File

@ -470,7 +470,9 @@ PAGE_RES* TessBaseAPI::Recognize(BLOCK_LIST* block_list, ETEXT_DESC* monitor) {
PAGE_RES* page_res = new PAGE_RES(block_list);
if (interactive_mode) {
pgeditor_main(block_list); //pgeditor user I/F
#ifndef GRAPHICS_DISABLED
pgeditor_main(block_list); // pgeditor user I/F
#endif
} else if (tessedit_train_from_boxes) {
apply_box_training(block_list);
} else {
@ -833,7 +835,11 @@ TBLOB *make_tesseract_blob(float baseline, float xheight, float descender, float
page_image.get_ysize());
// Create C_BLOBs from the page
extract_edges(NULL, &page_image, &page_image,
extract_edges(
#ifndef GRAPHICS_DISABLED
NULL,
#endif
&page_image, &page_image,
ICOORD(page_image.get_xsize(), page_image.get_ysize()),
block);

View File

@ -38,6 +38,7 @@
#include "control.h"
#ifndef GRAPHICS_DISABLED
#define ASC_HEIGHT (2 * bln_baseline_offset + bln_x_height)
#define X_HEIGHT (bln_baseline_offset + bln_x_height)
#define BL_HEIGHT bln_baseline_offset
@ -87,9 +88,7 @@ enum CMD_EVENTS
**********************************************************************/
ScrollView* image_win;
#ifndef GRAPHICS_DISABLED
VariablesEditor* ve;
#endif
bool stillRunning = false;
#ifdef __UNIX__
@ -660,9 +659,7 @@ void do_write_file( // serialise
void PGEventHandler::Notify(const SVEvent* event) {
char myval = '0';
if (event->type == SVET_POPUP) {
#ifndef GRAPHICS_DISABLED
ve->Notify(event);
#endif
} // These are handled by Var. Editor
else if (event->type == SVET_EXIT) { stillRunning = false; }
else if (event->type == SVET_MENU) {
@ -728,7 +725,7 @@ void pgeditor_msg( // message display
image_win->AddMessage(msg);
}
#endif // GRAPHCICS_DISABLED
/**********************************************************************
* pgeditor_read_file()
*
@ -739,6 +736,10 @@ void pgeditor_read_file( // of serialised file
STRING &name,
BLOCK_LIST *blocks // block list to add to
) {
#ifdef GRAPHICS_DISABLED
edges_and_textord(name.string(), blocks);
}
#else
int c; // input character
FILE *infp; // input file
BLOCK_IT block_it(blocks); // iterator
@ -1856,6 +1857,7 @@ BOOL8 word_toggle_seg( // toggle seg flag
return TRUE;
}
#endif // GRAPHICS_DISABLED
/* DEBUG ONLY */

View File

@ -140,7 +140,6 @@ void TesseractImage(const char* input_file, IMAGE* image, STRING* text_out) {
*
**********************************************************************/
#ifndef GRAPHICS_DISABLED
int main(int argc, char **argv) {
STRING outfile; //output file
@ -241,62 +240,6 @@ int main(int argc, char **argv) {
return 0; //Normal exit
}
#else
int main(int argc, char **argv) {
uinT16 lang; //language
STRING pagefile; //input file
if (argc < 4) {
USAGE.error (argv[0], EXIT,
"%s imagename outputbase configfile [[+|-]varfile]...\n", argv[0]);
}
time_t t_start = time(NULL);
init_tessembedded (argv[0], argv[2], argv[3], argc - 4, argv + 4);
tprintf ("Tesseract Open Source OCR Engine (graphics disabled)\n");
if (tessedit_read_image) {
#ifdef _TIFFIO_
TIFF* tif = TIFFOpen(argv[1], "r");
if (tif) {
read_tiff_image(tif);
TIFFClose(tif);
} else
READFAILED.error (argv[0], EXIT, argv[1]);
#else
if (page_image.read_header (argv[1]) < 0)
READFAILED.error (argv[0], EXIT, argv[1]);
if (page_image.read (page_image.get_ysize ()) < 0) {
MEMORY_OUT.error (argv[0], EXIT, "Read of image %s",
argv[1]);
}
#endif
}
pagefile = argv[1];
BLOCK_LIST current_block_list;
tessembedded_read_file(pagefile, &current_block_list);
tprintf ("Done reading files.\n");
PAGE_RES page_res(&current_block_list);
recog_all_words(&page_res, NULL);
current_block_list.clear();
ResetAdaptiveClassifier();
time_t t_end = time(NULL);
double secs = difftime(t_end, t_start);
tprintf ("Done. Number of seconds: %d\n", (int)secs);
return 0; //Normal exit
}
#endif
int initialized = 0;

View File

@ -42,7 +42,6 @@
#include "badwords.h"
#include "structures.h"
#define BLOB_MATCHING_ON
typedef void (*TESS_TESTER) (TBLOB *, BOOL8, char *, inT32, LIST);
typedef LIST (*TESS_MATCHER) (TBLOB *, TBLOB *, TBLOB *, void *, TEXTROW *);

View File

@ -17,8 +17,6 @@
*
**********************************************************************/
#define BLOB_MATCHING_ON
#include "mfcpch.h"
#include "fileerr.h"
#ifdef __UNIX__

View File

@ -23,15 +23,6 @@
#include "varable.h"
#include "notdll.h"
//#ifndef BLOB_MATCHING_ON
//class BLOB;
//class ROW;
// float compare_blobs(BLOB*,ROW*,BLOB*,ROW*)
//{
// return (float)MAX_INT32;
//}
//#endif
extern DLLSYM STRING datadir; //dir for data files
//name of image
extern DLLSYM STRING imagebasename;

View File

@ -1186,7 +1186,8 @@ void AdaptToChar(TBLOB *Blob,
MakePermanent (AdaptedTemplates, ClassId, NewTempConfigId,
Blob, LineStats);
if (LearningDebugLevel >= 1) {
#ifndef GRAPHICS_DISABLED
if (LearningDebugLevel >= 1) {
IntegerMatcher (IClass, AllProtosOn, AllConfigsOn,
NumFeatures, NumFeatures, IntFeatures, 0,
&IntResult, NO_DEBUG);
@ -1203,6 +1204,7 @@ void AdaptToChar(TBLOB *Blob,
GetClassToDebug ("Adapting");
}
}
#endif // GRAPHICS_DISABLED
}
FreeFeatureSet(FloatFeatures);
}

View File

@ -42,9 +42,6 @@
#define NULL 0 /*null pointer array index */
#endif
#define MAXINT 2147483647 /*max value of an int */
//#define MAXSHORT 32767 /*max value of short*/
//#define MAXCHAR 127 /*max value of a char*/
#define MAXUCHAR 255 /*max value of unsigned char */
#define PI 3.14159265359/*pi */
#ifndef __UNIX__

View File

@ -1188,7 +1188,7 @@ int LengthOfShortestAlphaRun(register char *Word, const char *Word_lengths) {
** Exceptions: none
** History: Tue May 14 07:50:45 1991, DSJ, Created.
*/
register int Shortest = MAXINT;
register int Shortest = MAX_INT32;
register int Length;
for (; *Word; Word += *(Word_lengths++))
@ -1202,7 +1202,7 @@ int LengthOfShortestAlphaRun(register char *Word, const char *Word_lengths) {
if (*Word == 0)
break;
}
if (Shortest == MAXINT)
if (Shortest == MAX_INT32)
Shortest = 0;
return (Shortest);

View File

@ -1,5 +1,5 @@
#!/bin/bash
winlist="tessdll.dll tessdll.lib tesseract.exe dlltest.exe training/cnTraining.exe training/mfTraining.exe training/unicharset_extractor.exe training/wordlist2dawg.exe"
winlist="tessdll.dll tessdll.lib tesseract.exe dlltest.exe training/cnTraining.exe training/mfTraining.exe training/unicharset_extractor.exe training/wordlist2dawg.exe java/ScrollView.jar"
ver=`ls -1rt *[0-9].tar.gz |tail -1`
ver=${ver%.tar.gz}
for l in eng deu fra ita spa nld por deu-f vie kan

View File

@ -22,7 +22,6 @@
class PBLOB;
class ROW;
#define BLOB_MATCHING_ON
float compare_blobs( //match 2 blobs
PBLOB *blob1, //first blob

View File

@ -20,6 +20,8 @@
#include "mfcpch.h"
#include "drawedg.h"
#ifndef GRAPHICS_DISABLED
#define IMAGE_WIN_NAME "Edges"//title of window
#define IMAGE_XPOS 250
#define IMAGE_YPOS 0 //default position
@ -72,3 +74,4 @@ void draw_raw_edge( //draw the cracks
while (edgept != start);
}
#endif // GRAPHICS_DISABLED

View File

@ -50,6 +50,7 @@ EXTERN FILE *to_debug = NULL;
*
* Create the to window used to show the fit.
**********************************************************************/
#ifndef GRAPHICS_DISABLED
void create_to_win( //make features win
ICOORD page_tr //size of page
@ -87,7 +88,6 @@ void create_todebug_win() { //make gradients win
to_debug = fopen (to_debugfile.string (), "w");
}
/**********************************************************************
* plot_blob_list
*
@ -466,3 +466,4 @@ void plot_row_cells( //draw words
win->Line(cell->x () + xshift, word_box.bottom (), cell->x () + xshift, word_box.top ());
}
}
#endif // GRAPHICS_DISABLED

View File

@ -42,10 +42,6 @@
const ERRCODE BLOCKLESS_BLOBS = "Warning:some blobs assigned to no block";
#ifdef GRAPHICS_DISABLED
ETEXT_DESC *global_monitor = NULL;
#endif
#define EXTERN
EXTERN BOOL_VAR (textord_no_rejects, FALSE, "Don't remove noise blobs");

View File

@ -54,7 +54,7 @@
AssemblerListingLocation=".\cntrain.Release/"
ObjectFile=".\cntrain.Release/"
ProgramDataBaseFileName=".\cntrain.Release/"
BrowseInformation="2"
BrowseInformation="0"
BrowseInformationFile=".\cntrain.Release/"
WarningLevel="3"
SuppressStartupBanner="true"

View File

@ -17,6 +17,8 @@
//
///////////////////////////////////////////////////////////////////////
//
#ifndef GRAPHICS_DISABLED
// This class contains the main ScrollView-logic,
// e.g. parsing & sending messages, images etc.
#ifdef WIN32
@ -30,7 +32,7 @@ const int kMaxIntPairSize = 45; // Holds %d,%d, for upto 64 bit.
#include "scrollview.h"
#include <stdarg.h>
#include <string.h>
#include <string.h>
#include <map>
#include <utility>
#include <algorithm>
@ -817,3 +819,6 @@ int ScrollView::TranslateYCoordinate(int y) {
if (!y_axis_is_reversed_) { return y;
} else { return y_size_ - y; }
}
#endif // GRAPHICS_DISABLED

View File

@ -150,6 +150,8 @@ class ScrollView {
GREEN_YELLOW // Make sure this one is last.
};
#ifndef GRAPHICS_DISABLED
// Create a window. The pixel size of the window may be 0,0, in which case
// a default size is selected based on the size of your canvas.
// The canvas may not be 0,0 in size!
@ -404,6 +406,7 @@ class ScrollView {
// Semaphore to the thread belonging to this window.
SVSemaphore* semaphore_;
#endif // GRAPHICS_DISABLED
};
#endif // THIRD_PARTY_TESSERACT_VIEWER_SCROLLVIEW_H__

View File

@ -26,6 +26,8 @@
// menu bars.
#include "svmnode.h"
#ifndef GRAPHICS_DISABLED
#include <iostream>
#include <cstring>
@ -133,3 +135,5 @@ void SVMenuNode::BuildMenu(ScrollView* sv, bool menu_bar) {
if (child_ != NULL) { child_->BuildMenu(sv, menu_bar); delete child_; }
if (next_ != NULL) { next_->BuildMenu(sv, menu_bar); delete next_; }
}
#endif // GRAPHICS_DISABLED

View File

@ -20,6 +20,8 @@
// SVUtil contains the SVSync and SVNetwork classes, which are used for
// thread/process creation & synchronization and network connection.
#ifndef GRAPHICS_DISABLED
#include "svutil.h"
#ifdef WIN32
@ -341,3 +343,5 @@ SVNetwork::~SVNetwork() {
delete[] msg_buffer_in_;
delete mutex_send_;
}
#endif // GRAPHICS_DISABLED

View File

@ -22,6 +22,7 @@
#include "werd.h"
#include "drawfx.h"
#ifndef GRAPHICS_DISABLED
#define FXDEMOWIN "FXDemo"
#define FXDEMOXPOS 250
#define FXDEMOYPOS 0
@ -73,6 +74,7 @@ void clear_fx_win() { //make features win
fx_win->Line(-WERDWIDTH, bln_x_height + bln_baseline_offset, WERDWIDTH, bln_x_height + bln_baseline_offset);
}
#endif // GRAPHICS_DISABLED
/**********************************************************************
* create_fxdebug_win

View File

@ -144,10 +144,10 @@ void end_metrics() {
void record_certainty(float certainty, int pass) {
int bucket;
if (certainty / CERTAINTY_BUCKET_SIZE < MAXINT)
if (certainty / CERTAINTY_BUCKET_SIZE < MAX_INT32)
bucket = (int) (certainty / CERTAINTY_BUCKET_SIZE);
else
bucket = MAXINT;
bucket = MAX_INT32;
inc_tally_bucket (best_certainties[pass - 1], bucket);
}

View File

@ -112,10 +112,10 @@ void eliminate_duplicate_outlines(TBLOB *blob) {
**********************************************************************/
void setup_outline(TESSLINE *outline) {
register EDGEPT *this_edge;
register int minx = MAXINT;
register int miny = MAXINT;
register int maxx = -MAXINT;
register int maxy = -MAXINT;
register int minx = MAX_INT32;
register int miny = MAX_INT32;
register int maxx = -MAX_INT32;
register int maxy = -MAX_INT32;
/* Find boundaries */
this_edge = outline->loop;

View File

@ -30,6 +30,8 @@
#include "render.h"
#include "split.h"
#ifndef GRAPHICS_DISABLED
/*----------------------------------------------------------------------
V a r i a b l e s
----------------------------------------------------------------------*/
@ -128,3 +130,5 @@ void mark_split(SPLIT *split) {
c_draw (window, (float) split->point2->pos.x, (float) split->point2->pos.y);
c_make_current(window);
}
#endif // GRAPHICS_DISABLED

View File

@ -34,6 +34,8 @@
#include "const.h"
#include <math.h>
#ifndef GRAPHICS_DISABLED
/*----------------------------------------------------------------------
V a r i a b l e s
----------------------------------------------------------------------*/
@ -104,9 +106,11 @@ void render_segmentation(ScrollView *window,
if (char_num < segmentation[0])
chunks_left = segmentation[char_num + 1];
else
chunks_left = MAXINT;
chunks_left = MAX_INT32;
}
render_outline(window, blob->outlines, color);
}
window->ZoomToRectangle(topleft.x, topleft.y, botright.x, botright.y);
}
#endif // GRPAHICS_DISABLED

View File

@ -54,6 +54,7 @@ make_toggle_var (blob_pause, 0, make_blob_pause,
/*----------------------------------------------------------------------
F u n c t i o n s
----------------------------------------------------------------------*/
#ifndef GRAPHICS_DISABLED
/**********************************************************************
* display_blob
*
@ -147,3 +148,5 @@ void render_outline(void *window,
/* Add on child outlines */
render_outline(window, outline->child, Grey);
}
#endif // GRAPHICS_DISABLED