fix build with -DGRAPHICS_DISABLED

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@981 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
zdenop 2014-01-11 23:08:54 +00:00
parent 8299e2a605
commit 9cf08ca8d3
23 changed files with 121 additions and 65 deletions

View File

@ -17,6 +17,11 @@
* *
**********************************************************************/ **********************************************************************/
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "ratngs.h" #include "ratngs.h"
#include "blobs.h" #include "blobs.h"

View File

@ -19,6 +19,10 @@
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
Include Files and Type Defines Include Files and Type Defines
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include <ctype.h> #include <ctype.h>
#include "ambigs.h" #include "ambigs.h"
#include "blobclass.h" #include "blobclass.h"
@ -58,11 +62,6 @@
#include <assert.h> #include <assert.h>
#endif #endif
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#define ADAPT_TEMPLATE_SUFFIX ".a" #define ADAPT_TEMPLATE_SUFFIX ".a"
#define MAX_MATCHES 10 #define MAX_MATCHES 10
@ -2263,10 +2262,11 @@ void Classify::SetAdaptiveThreshold(FLOAT32 Threshold) {
* @note Exceptions: none * @note Exceptions: none
* @note History: Fri Mar 22 08:43:52 1991, DSJ, Created. * @note History: Fri Mar 22 08:43:52 1991, DSJ, Created.
*/ */
#ifndef GRAPHICS_DISABLED
void Classify::ShowBestMatchFor(int shape_id, void Classify::ShowBestMatchFor(int shape_id,
const INT_FEATURE_STRUCT* features, const INT_FEATURE_STRUCT* features,
int num_features) { int num_features) {
#ifndef GRAPHICS_DISABLED
uinT32 config_mask; uinT32 config_mask;
if (UnusedClassIdIn(PreTrainedTemplates, shape_id)) { if (UnusedClassIdIn(PreTrainedTemplates, shape_id)) {
tprintf("No built-in templates for class/shape %d\n", shape_id); tprintf("No built-in templates for class/shape %d\n", shape_id);
@ -2295,8 +2295,8 @@ void Classify::ShowBestMatchFor(int shape_id,
matcher_debug_flags, matcher_debug_flags,
matcher_debug_separate_windows); matcher_debug_separate_windows);
UpdateMatchDisplay(); UpdateMatchDisplay();
#endif // GRAPHICS_DISABLED
} /* ShowBestMatchFor */ } /* ShowBestMatchFor */
#endif
// Returns a string for the classifier class_id: either the corresponding // Returns a string for the classifier class_id: either the corresponding
// unicharset debug_str or the shape_table_ debug str. // unicharset debug_str or the shape_table_ debug str.

View File

@ -20,6 +20,10 @@
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "shapeclassifier.h" #include "shapeclassifier.h"
#include "genericvector.h" #include "genericvector.h"
#include "scrollview.h" #include "scrollview.h"
@ -93,6 +97,7 @@ const UNICHARSET& ShapeClassifier::GetUnicharset() const {
void ShapeClassifier::DebugDisplay(const TrainingSample& sample, void ShapeClassifier::DebugDisplay(const TrainingSample& sample,
Pix* page_pix, Pix* page_pix,
UNICHAR_ID unichar_id) { UNICHAR_ID unichar_id) {
#ifndef GRAPHICS_DISABLED
static ScrollView* terminator = NULL; static ScrollView* terminator = NULL;
if (terminator == NULL) { if (terminator == NULL) {
terminator = new ScrollView("XIT", 0, 0, 50, 50, 50, 50, true); terminator = new ScrollView("XIT", 0, 0, 50, 50, 50, 50, true);
@ -148,6 +153,7 @@ void ShapeClassifier::DebugDisplay(const TrainingSample& sample,
ev_type != SVET_CLICK && ev_type != SVET_DESTROY); ev_type != SVET_CLICK && ev_type != SVET_DESTROY);
} while (ev_type != SVET_CLICK && ev_type != SVET_DESTROY); } while (ev_type != SVET_CLICK && ev_type != SVET_DESTROY);
delete debug_win; delete debug_win;
#endif // GRAPHICS_DISABLED
} }
// Displays classification as the given shape_id. Creates as many windows // Displays classification as the given shape_id. Creates as many windows

View File

@ -17,14 +17,13 @@
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
#include "alignedblob.h"
#include "ndminx.h"
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config_auto.h" #include "config_auto.h"
#endif #endif
#include "alignedblob.h"
#include "ndminx.h"
INT_VAR(textord_debug_tabfind, 0, "Debug tab finding"); INT_VAR(textord_debug_tabfind, 0, "Debug tab finding");
INT_VAR(textord_debug_bugs, 0, "Turn on output related to bugs in tab finding"); INT_VAR(textord_debug_bugs, 0, "Turn on output related to bugs in tab finding");
INT_VAR(textord_testregion_left, -1, "Left edge of debug reporting rectangle"); INT_VAR(textord_testregion_left, -1, "Left edge of debug reporting rectangle");

View File

@ -21,6 +21,10 @@
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#endif // _MSC_VER #endif // _MSC_VER
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "baselinedetect.h" #include "baselinedetect.h"
#include <math.h> #include <math.h>

View File

@ -17,6 +17,10 @@
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "ccnontextdetect.h" #include "ccnontextdetect.h"
#include "imagefind.h" #include "imagefind.h"
#include "strokewidth.h" #include "strokewidth.h"

View File

@ -18,6 +18,14 @@
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
#ifdef _MSC_VER
#pragma warning(disable:4244) // Conversion warnings
#endif
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "colpartition.h" #include "colpartition.h"
#include "colpartitiongrid.h" #include "colpartitiongrid.h"
#include "colpartitionset.h" #include "colpartitionset.h"
@ -26,10 +34,6 @@
#include "imagefind.h" #include "imagefind.h"
#include "workingpartset.h" #include "workingpartset.h"
#ifdef _MSC_VER
#pragma warning(disable:4244) // Conversion warnings
#endif
namespace tesseract { namespace tesseract {
ELIST2IZE(ColPartition) ELIST2IZE(ColPartition)

View File

@ -17,6 +17,10 @@
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "colpartitiongrid.h" #include "colpartitiongrid.h"
#include "colpartitionset.h" #include "colpartitionset.h"
#include "imagefind.h" #include "imagefind.h"

View File

@ -18,6 +18,10 @@
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "colpartitionset.h" #include "colpartitionset.h"
#include "ndminx.h" #include "ndminx.h"
#include "workingpartset.h" #include "workingpartset.h"

View File

@ -18,6 +18,10 @@
* *
**********************************************************************/ **********************************************************************/
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "devanagari_processing.h" #include "devanagari_processing.h"
#include "allheaders.h" #include "allheaders.h"
#include "tordmain.h" #include "tordmain.h"

View File

@ -17,15 +17,14 @@
* *
**********************************************************************/ **********************************************************************/
#include "pithsync.h"
#include "topitch.h"
#include "drawtord.h"
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config_auto.h" #include "config_auto.h"
#endif #endif
#include "pithsync.h"
#include "topitch.h"
#include "drawtord.h"
#define TO_WIN_XPOS 0 //default window pos #define TO_WIN_XPOS 0 //default window pos
#define TO_WIN_YPOS 0 #define TO_WIN_YPOS 0
#define TO_WIN_NAME "Textord" #define TO_WIN_NAME "Textord"

View File

@ -22,6 +22,10 @@
#pragma warning(disable:4244) // Conversion warnings #pragma warning(disable:4244) // Conversion warnings
#endif #endif
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "imagefind.h" #include "imagefind.h"
#include "colpartitiongrid.h" #include "colpartitiongrid.h"
#include "linlsq.h" #include "linlsq.h"
@ -29,11 +33,6 @@
#include "statistc.h" #include "statistc.h"
#include "params.h" #include "params.h"
// This entire file is dependent upon leptonica. If you don't have it,
// you don't get this functionality.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "allheaders.h" #include "allheaders.h"
INT_VAR(textord_tabfind_show_images, false, "Show image blobs"); INT_VAR(textord_tabfind_show_images, false, "Show image blobs");

View File

@ -22,6 +22,10 @@
#pragma warning(disable:4244) // Conversion warnings #pragma warning(disable:4244) // Conversion warnings
#endif #endif
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "linefind.h" #include "linefind.h"
#include "alignedblob.h" #include "alignedblob.h"
#include "tabvector.h" #include "tabvector.h"
@ -29,11 +33,6 @@
#include "edgblob.h" #include "edgblob.h"
#include "openclwrapper.h" #include "openclwrapper.h"
// This entire file is dependent upon leptonica. If you don't have it,
// then the code doesn't do anything useful.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "allheaders.h" #include "allheaders.h"
namespace tesseract { namespace tesseract {

View File

@ -21,6 +21,10 @@
#pragma warning(disable:4244) // Conversion warnings #pragma warning(disable:4244) // Conversion warnings
#endif #endif
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "strokewidth.h" #include "strokewidth.h"
#include <math.h> #include <math.h>
@ -35,11 +39,6 @@
#include "textlineprojection.h" #include "textlineprojection.h"
#include "tordmain.h" // For SetBlobStrokeWidth. #include "tordmain.h" // For SetBlobStrokeWidth.
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
namespace tesseract { namespace tesseract {
INT_VAR(textord_tabfind_show_strokewidths, 0, "Show stroke widths"); INT_VAR(textord_tabfind_show_strokewidths, 0, "Show stroke widths");
@ -1871,11 +1870,11 @@ ScrollView* StrokeWidth::DisplayGoodBlobs(const char* window_name,
} }
static void DrawDiacriticJoiner(const BLOBNBOX* blob, ScrollView* window) { static void DrawDiacriticJoiner(const BLOBNBOX* blob, ScrollView* window) {
#ifndef GRAPHICS_DISABLED
const TBOX& blob_box(blob->bounding_box()); const TBOX& blob_box(blob->bounding_box());
int top = MAX(blob_box.top(), blob->base_char_top()); int top = MAX(blob_box.top(), blob->base_char_top());
int bottom = MIN(blob_box.bottom(), blob->base_char_bottom()); int bottom = MIN(blob_box.bottom(), blob->base_char_bottom());
int x = (blob_box.left() + blob_box.right()) / 2; int x = (blob_box.left() + blob_box.right()) / 2;
#ifndef GRAPHICS_DISABLED
window->Line(x, top, x, bottom); window->Line(x, top, x, bottom);
#endif // GRAPHICS_DISABLED #endif // GRAPHICS_DISABLED
} }

View File

@ -17,6 +17,10 @@
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "tabfind.h" #include "tabfind.h"
#include "alignedblob.h" #include "alignedblob.h"
#include "blobbox.h" #include "blobbox.h"
@ -25,11 +29,6 @@
#include "linefind.h" #include "linefind.h"
#include "ndminx.h" #include "ndminx.h"
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
namespace tesseract { namespace tesseract {
// Multiple of box size to search for initial gaps. // Multiple of box size to search for initial gaps.

View File

@ -21,12 +21,13 @@
#pragma warning(disable:4244) // Conversion warnings #pragma warning(disable:4244) // Conversion warnings
#endif #endif
#include "tablefind.h"
#include <math.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config_auto.h" #include "config_auto.h"
#endif #endif
#include "tablefind.h"
#include <math.h>
#include "allheaders.h" #include "allheaders.h"
#include "colpartitionset.h" #include "colpartitionset.h"
@ -271,6 +272,8 @@ void TableFinder::LocateTables(ColPartitionGrid* grid,
const FCOORD& reskew) { const FCOORD& reskew) {
// initialize spacing, neighbors, and columns // initialize spacing, neighbors, and columns
InitializePartitions(all_columns); InitializePartitions(all_columns);
#ifndef GRAPHICS_DISABLED
if (textord_show_tables) { if (textord_show_tables) {
ScrollView* table_win = MakeWindow(0, 300, "Column Partitions & Neighbors"); ScrollView* table_win = MakeWindow(0, 300, "Column Partitions & Neighbors");
DisplayColPartitions(table_win, &clean_part_grid_, ScrollView::BLUE); DisplayColPartitions(table_win, &clean_part_grid_, ScrollView::BLUE);
@ -282,6 +285,8 @@ void TableFinder::LocateTables(ColPartitionGrid* grid,
table_win = MakeWindow(100, 300, "Fragmented Text"); table_win = MakeWindow(100, 300, "Fragmented Text");
DisplayColPartitions(table_win, &fragmented_text_grid_, ScrollView::BLUE); DisplayColPartitions(table_win, &fragmented_text_grid_, ScrollView::BLUE);
} }
#endif // GRAPHICS_DISABLED
// mark, filter, and smooth candidate table partitions // mark, filter, and smooth candidate table partitions
MarkTablePartitions(); MarkTablePartitions();
@ -310,11 +315,13 @@ void TableFinder::LocateTables(ColPartitionGrid* grid,
ColSegment_LIST table_regions; ColSegment_LIST table_regions;
GetTableRegions(&table_columns, &table_regions); GetTableRegions(&table_columns, &table_regions);
#ifndef GRAPHICS_DISABLED
if (textord_tablefind_show_mark) { if (textord_tablefind_show_mark) {
ScrollView* table_win = MakeWindow(1200, 300, "Table Columns and Regions"); ScrollView* table_win = MakeWindow(1200, 300, "Table Columns and Regions");
DisplayColSegments(table_win, &table_columns, ScrollView::DARK_TURQUOISE); DisplayColSegments(table_win, &table_columns, ScrollView::DARK_TURQUOISE);
DisplayColSegments(table_win, &table_regions, ScrollView::YELLOW); DisplayColSegments(table_win, &table_regions, ScrollView::YELLOW);
} }
#endif // GRAPHICS_DISABLED
// Merge table regions across columns for tables spanning multiple // Merge table regions across columns for tables spanning multiple
// columns // columns
@ -330,24 +337,28 @@ void TableFinder::LocateTables(ColPartitionGrid* grid,
// Remove false alarms consiting of a single column // Remove false alarms consiting of a single column
DeleteSingleColumnTables(); DeleteSingleColumnTables();
#ifndef GRAPHICS_DISABLED
if (textord_show_tables) { if (textord_show_tables) {
ScrollView* table_win = MakeWindow(1200, 300, "Detected Table Locations"); ScrollView* table_win = MakeWindow(1200, 300, "Detected Table Locations");
DisplayColPartitions(table_win, &clean_part_grid_, ScrollView::BLUE); DisplayColPartitions(table_win, &clean_part_grid_, ScrollView::BLUE);
DisplayColSegments(table_win, &table_columns, ScrollView::KHAKI); DisplayColSegments(table_win, &table_columns, ScrollView::KHAKI);
table_grid_.DisplayBoxes(table_win); table_grid_.DisplayBoxes(table_win);
} }
#endif // GRAPHICS_DISABLED
// Find table grid structure and reject tables that are malformed. // Find table grid structure and reject tables that are malformed.
RecognizeTables(); RecognizeTables();
GridMergeTableRegions(); GridMergeTableRegions();
RecognizeTables(); RecognizeTables();
#ifndef GRAPHICS_DISABLED
if (textord_show_tables) { if (textord_show_tables) {
ScrollView* table_win = MakeWindow(1400, 600, "Recognized Tables"); ScrollView* table_win = MakeWindow(1400, 600, "Recognized Tables");
DisplayColPartitions(table_win, &clean_part_grid_, DisplayColPartitions(table_win, &clean_part_grid_,
ScrollView::BLUE, ScrollView::BLUE); ScrollView::BLUE, ScrollView::BLUE);
table_grid_.DisplayBoxes(table_win); table_grid_.DisplayBoxes(table_win);
} }
#endif // GRAPHICS_DISABLED
} else { } else {
// Remove false alarms consiting of a single column // Remove false alarms consiting of a single column
// TODO(nbeato): verify this is a NOP after structured table rejection. // TODO(nbeato): verify this is a NOP after structured table rejection.
@ -355,12 +366,14 @@ void TableFinder::LocateTables(ColPartitionGrid* grid,
// supposed to do, this function is obsolete. // supposed to do, this function is obsolete.
DeleteSingleColumnTables(); DeleteSingleColumnTables();
#ifndef GRAPHICS_DISABLED
if (textord_show_tables) { if (textord_show_tables) {
ScrollView* table_win = MakeWindow(1500, 300, "Detected Tables"); ScrollView* table_win = MakeWindow(1500, 300, "Detected Tables");
DisplayColPartitions(table_win, &clean_part_grid_, DisplayColPartitions(table_win, &clean_part_grid_,
ScrollView::BLUE, ScrollView::BLUE); ScrollView::BLUE, ScrollView::BLUE);
table_grid_.DisplayBoxes(table_win); table_grid_.DisplayBoxes(table_win);
} }
#endif // GRAPHICS_DISABLED
} }
if (textord_dump_table_images) if (textord_dump_table_images)

View File

@ -20,6 +20,10 @@
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "tablerecog.h" #include "tablerecog.h"
namespace tesseract { namespace tesseract {

View File

@ -21,6 +21,10 @@
#pragma warning(disable:4244) // Conversion warnings #pragma warning(disable:4244) // Conversion warnings
#endif #endif
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "tabvector.h" #include "tabvector.h"
#include "blobbox.h" #include "blobbox.h"
#include "colfind.h" #include "colfind.h"
@ -28,11 +32,6 @@
#include "detlinefit.h" #include "detlinefit.h"
#include "statistc.h" #include "statistc.h"
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
namespace tesseract { namespace tesseract {
// Multiple of height used as a gutter for evaluation search. // Multiple of height used as a gutter for evaluation search.

View File

@ -11,6 +11,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "textlineprojection.h" #include "textlineprojection.h"
#include "allheaders.h" #include "allheaders.h"
#include "bbgrid.h" // Base class. #include "bbgrid.h" // Base class.

View File

@ -16,6 +16,11 @@
** limitations under the License. ** limitations under the License.
* *
**********************************************************************/ **********************************************************************/
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#ifdef __UNIX__ #ifdef __UNIX__
#include <assert.h> #include <assert.h>
#endif #endif
@ -32,11 +37,6 @@
#include "tordmain.h" #include "tordmain.h"
#include "secname.h" #include "secname.h"
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "allheaders.h" #include "allheaders.h"
const ERRCODE BLOCKLESS_BLOBS = "Warning:some blobs assigned to no block"; const ERRCODE BLOCKLESS_BLOBS = "Warning:some blobs assigned to no block";

View File

@ -26,6 +26,10 @@
/**---------------------------------------------------------------------------- /**----------------------------------------------------------------------------
Include Files and Type Defines Include Files and Type Defines
----------------------------------------------------------------------------**/ ----------------------------------------------------------------------------**/
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES

View File

@ -16,6 +16,10 @@
// training data of whole, partial or multiple characters. // training data of whole, partial or multiple characters.
// Author: Ray Smith // Author: Ray Smith
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#ifndef USE_STD_NAMESPACE #ifndef USE_STD_NAMESPACE
#include "base/commandlineflags.h" #include "base/commandlineflags.h"
#endif #endif

View File

@ -17,15 +17,14 @@
* *
**********************************************************************/ **********************************************************************/
#include "drawfx.h"
#include "normalis.h"
#include "werd.h"
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config_auto.h" #include "config_auto.h"
#endif #endif
#include "drawfx.h"
#include "normalis.h"
#include "werd.h"
#ifndef GRAPHICS_DISABLED #ifndef GRAPHICS_DISABLED
#define FXDEMOWIN "FXDemo" #define FXDEMOWIN "FXDemo"
#define FXDEMOXPOS 250 #define FXDEMOXPOS 250