Merge pull request #2465 from stweil/warnings

Fix compiler warnings [-Wmissing-variable-declarations]
This commit is contained in:
zdenop 2019-05-26 19:50:39 +02:00 committed by GitHub
commit 39715629fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 313 additions and 390 deletions

View File

@ -94,7 +94,7 @@
#include "tprintf.h" // for tprintf
#include "werd.h" // for WERD, WERD_IT, W_FUZZY_NON, W_FUZZY_SP
BOOL_VAR(stream_filelist, false, "Stream a filelist from stdin");
static BOOL_VAR(stream_filelist, false, "Stream a filelist from stdin");
namespace tesseract {
@ -110,11 +110,11 @@ const char kUNLVSuspect = '^';
* Filename used for input image file, from which to derive a name to search
* for a possible UNLV zone file, if none is specified by SetInputName.
*/
const char* kInputFile = "noname.tif";
static const char* kInputFile = "noname.tif";
/**
* Temp file used for storing current parameters before applying retry values.
*/
const char* kOldVarsFile = "failed_vars.txt";
static const char* kOldVarsFile = "failed_vars.txt";
/** Max string length of an int. */
const int kMaxIntSize = 22;

View File

@ -2,7 +2,6 @@
// File: equationdetect.cpp
// Description: Helper classes to detect equations.
// Author: Zongyi (Joe) Liu (joeliu@google.com)
// Created: Fri Aug 31 11:13:01 PST 2011
//
// (C) Copyright 2011, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
@ -43,10 +42,10 @@
#include "tesseractclass.h"
// Config variables.
BOOL_VAR(equationdetect_save_bi_image, false, "Save input bi image");
BOOL_VAR(equationdetect_save_spt_image, false, "Save special character image");
BOOL_VAR(equationdetect_save_seed_image, false, "Save the seed image");
BOOL_VAR(equationdetect_save_merged_image, false, "Save the merged image");
static BOOL_VAR(equationdetect_save_bi_image, false, "Save input bi image");
static BOOL_VAR(equationdetect_save_spt_image, false, "Save special character image");
static BOOL_VAR(equationdetect_save_seed_image, false, "Save the seed image");
static BOOL_VAR(equationdetect_save_merged_image, false, "Save the merged image");
namespace tesseract {

View File

@ -44,8 +44,6 @@
#define DESC_HEIGHT 0
#define MAXSPACING 128 /*max expected spacing in pix */
constexpr ERRCODE EMPTYBLOCKLIST("No blocks to edit");
enum CMD_EVENTS
{
NULL_CMD_EVENT,
@ -117,13 +115,13 @@ static bool display_image = false;
static bool display_blocks = false;
static bool display_baselines = false;
PAGE_RES *current_page_res = nullptr;
static PAGE_RES *current_page_res = nullptr;
STRING_VAR(editor_image_win_name, "EditorImage",
"Editor image window name");
INT_VAR(editor_image_xpos, 590, "Editor image X Pos");
INT_VAR(editor_image_ypos, 10, "Editor image Y Pos");
INT_VAR(editor_image_menuheight, 50, "Add to image height for menu bar");
static INT_VAR(editor_image_menuheight, 50, "Add to image height for menu bar");
INT_VAR(editor_image_word_bb_color, ScrollView::BLUE,
"Word bounding box colour");
INT_VAR(editor_image_blob_bb_color, ScrollView::YELLOW,
@ -144,7 +142,7 @@ INT_VAR(editor_word_ypos, 510, "Word window Y Pos");
INT_VAR(editor_word_height, 240, "Word window height");
INT_VAR(editor_word_width, 655, "Word window width");
STRING_VAR(editor_debug_config_file, "", "Config file to apply to single words");
static STRING_VAR(editor_debug_config_file, "", "Config file to apply to single words");
/**
* show_point()

View File

@ -2,7 +2,6 @@
* File: mod128.cpp (Formerly dir128.c)
* Description: Code to convert a DIR128 to an ICOORD.
* Author: Ray Smith
* Created: Tue Oct 22 11:56:09 BST 1991
*
* (C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
@ -54,7 +53,7 @@ static const int16_t idirtab[] = {
980, -195, 989, -146, 995, -98, 998, -49
};
const ICOORD* dirtab = reinterpret_cast<const ICOORD*>(idirtab);
static const ICOORD* dirtab = reinterpret_cast<const ICOORD*>(idirtab);
/**********************************************************************
* DIR128::DIR128

View File

@ -31,8 +31,8 @@
#define EXTERN
#define FASTEDGELENGTH 256
EXTERN BOOL_VAR(poly_debug, false, "Debug old poly");
EXTERN BOOL_VAR(poly_wide_objects_better, true,
static BOOL_VAR(poly_debug, false, "Debug old poly");
static BOOL_VAR(poly_wide_objects_better, true,
"More accurate approx on wide things");
#define FIXED 4 /*OUTLINE point is fixed */

View File

@ -29,9 +29,6 @@
#define LAST_COLOUR ScrollView::AQUAMARINE ///< last rainbow colour
#define CHILD_COLOUR ScrollView::BROWN ///< colour of children
constexpr ERRCODE CANT_SCALE_EDGESTEPS(
"Attempted to scale an edgestep format word");
ELIST2IZE(WERD)
/**

View File

@ -24,11 +24,10 @@
class DLLSYM BITS16 {
public:
uint16_t val;
uint16_t val = 0;
BITS16() { val = 0; } // constructor
BITS16(uint16_t init) { val = init; }
BITS16() = default;
BITS16(uint16_t init) : val(init) {}
void turn_on_bit( // flip specified bit
uint8_t bit_num) { // bit to flip 0..7

View File

@ -2,7 +2,6 @@
* File: mainblk.cpp (Formerly main.c)
* Description: Function to call from main() to setup.
* Author: Ray Smith
* Created: Tue Oct 22 11:09:40 BST 1991
*
* (C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
@ -25,10 +24,6 @@
#include "fileerr.h"
#include "ccutil.h"
const ERRCODE NO_PATH =
"Warning:explicit path for executable will not be used for configs";
static const ERRCODE USAGE = "Usage";
namespace tesseract {
/**********************************************************************
* main_setup

View File

@ -31,9 +31,6 @@ using tesseract::TFile;
// Size of buffer needed to host the decimal representation of the maximum
// possible length of an int (in 64 bits), being -<20 digits>.
const int kMaxIntSize = 22;
// Size of buffer needed to host the decimal representation of the maximum
// possible length of a %.8g being -1.2345678e+999<nul> = 16.
const int kMaxDoubleSize = 16;
/**********************************************************************
* STRING_HEADER provides metadata about the allocated buffer,

View File

@ -26,7 +26,7 @@
namespace tesseract {
// String used to represent the null_id in direct_set.
const char* kNullChar = "<nul>";
static const char* kNullChar = "<nul>";
// Radix to make unique values from the stored radical codes.
const int kRadicalRadix = 29;

View File

@ -20,9 +20,9 @@
namespace tesseract {
constexpr const char *kLRM = "\u200E"; // Left-to-Right Mark
constexpr const char *kRLM = "\u200F"; // Right-to-Left Mark
constexpr const char *kRLE = "\u202A"; // Right-to-Left Embedding
constexpr const char *kPDF = "\u202C"; // Pop Directional Formatting
const char * const kLRM = "\u200E"; // Left-to-Right Mark
const char * const kRLM = "\u200F"; // Right-to-Left Mark
const char * const kRLE = "\u202A"; // Right-to-Left Embedding
const char * const kPDF = "\u202C"; // Pop Directional Formatting
} // namespace

View File

@ -2,7 +2,6 @@
** Filename: blobclass.c
** Purpose: High level blob classification and training routines.
** Author: Dan Johnson
** History: 7/21/89, DSJ, Created.
**
** (c) Copyright Hewlett-Packard Company, 1988.
** Licensed under the Apache License, Version 2.0 (the "License");
@ -32,8 +31,8 @@
static const char kUnknownFontName[] = "UnknownFont";
STRING_VAR(classify_font_name, kUnknownFontName,
"Default font name to be used in training");
static STRING_VAR(classify_font_name, kUnknownFontName,
"Default font name to be used in training");
namespace tesseract {
/**----------------------------------------------------------------------------

View File

@ -18,21 +18,21 @@
Include Files and Type Defines
-----------------------------------------------------------------------------*/
#include "featdefs.h"
#include "emalloc.h"
#include "scanutils.h"
#include <cstring>
#include <cstdio>
#include "emalloc.h"
#include "picofeat.h" // for PicoFeatureLength
#include "scanutils.h"
#define PICO_FEATURE_LENGTH 0.05
/*-----------------------------------------------------------------------------
Global Data Definitions and Declarations
-----------------------------------------------------------------------------*/
constexpr const char* kMicroFeatureType = "mf";
constexpr const char* kCNFeatureType = "cn";
constexpr const char* kIntFeatureType = "if";
constexpr const char* kGeoFeatureType = "tb";
const char* const kMicroFeatureType = "mf";
const char* const kCNFeatureType = "cn";
const char* const kIntFeatureType = "if";
const char* const kGeoFeatureType = "tb";
// Define all of the parameters for the MicroFeature type.
StartParamDesc(MicroFeatureParams)

View File

@ -41,15 +41,14 @@ using tesseract::TrainingSample;
// The entries are in binary degrees where a full circle is 256 binary degrees.
static float cos_table[INT_CHAR_NORM_RANGE];
static float sin_table[INT_CHAR_NORM_RANGE];
// Guards write access to AtanTable so we don't create it more than once.
tesseract::CCUtilMutex atan_table_mutex;
/**----------------------------------------------------------------------------
Public Code
----------------------------------------------------------------------------**/
void InitIntegerFX() {
// Guards write access to AtanTable so we don't create it more than once.
static tesseract::CCUtilMutex atan_table_mutex;
static bool atan_table_init = false;
atan_table_mutex.Lock();
if (!atan_table_init) {

View File

@ -172,31 +172,31 @@ int TruncateParam(float Param, int Min, int Max, char *Id);
-----------------------------------------------------------------------------*/
/* global display lists used to display proto and feature match information*/
ScrollView *IntMatchWindow = nullptr;
ScrollView *FeatureDisplayWindow = nullptr;
ScrollView *ProtoDisplayWindow = nullptr;
static ScrollView* IntMatchWindow = nullptr;
static ScrollView* FeatureDisplayWindow = nullptr;
static ScrollView* ProtoDisplayWindow = nullptr;
/*-----------------------------------------------------------------------------
Variables
-----------------------------------------------------------------------------*/
/* control knobs */
INT_VAR(classify_num_cp_levels, 3, "Number of Class Pruner Levels");
double_VAR(classify_cp_angle_pad_loose, 45.0,
"Class Pruner Angle Pad Loose");
double_VAR(classify_cp_angle_pad_medium, 20.0,
"Class Pruner Angle Pad Medium");
double_VAR(classify_cp_angle_pad_tight, 10.0,
"CLass Pruner Angle Pad Tight");
double_VAR(classify_cp_end_pad_loose, 0.5, "Class Pruner End Pad Loose");
double_VAR(classify_cp_end_pad_medium, 0.5, "Class Pruner End Pad Medium");
double_VAR(classify_cp_end_pad_tight, 0.5, "Class Pruner End Pad Tight");
double_VAR(classify_cp_side_pad_loose, 2.5, "Class Pruner Side Pad Loose");
double_VAR(classify_cp_side_pad_medium, 1.2, "Class Pruner Side Pad Medium");
double_VAR(classify_cp_side_pad_tight, 0.6, "Class Pruner Side Pad Tight");
double_VAR(classify_pp_angle_pad, 45.0, "Proto Pruner Angle Pad");
double_VAR(classify_pp_end_pad, 0.5, "Proto Prune End Pad");
double_VAR(classify_pp_side_pad, 2.5, "Proto Pruner Side Pad");
static INT_VAR(classify_num_cp_levels, 3, "Number of Class Pruner Levels");
static double_VAR(classify_cp_angle_pad_loose, 45.0,
"Class Pruner Angle Pad Loose");
static double_VAR(classify_cp_angle_pad_medium, 20.0,
"Class Pruner Angle Pad Medium");
static double_VAR(classify_cp_angle_pad_tight, 10.0,
"CLass Pruner Angle Pad Tight");
static double_VAR(classify_cp_end_pad_loose, 0.5, "Class Pruner End Pad Loose");
static double_VAR(classify_cp_end_pad_medium, 0.5, "Class Pruner End Pad Medium");
static double_VAR(classify_cp_end_pad_tight, 0.5, "Class Pruner End Pad Tight");
static double_VAR(classify_cp_side_pad_loose, 2.5, "Class Pruner Side Pad Loose");
static double_VAR(classify_cp_side_pad_medium, 1.2, "Class Pruner Side Pad Medium");
static double_VAR(classify_cp_side_pad_tight, 0.6, "Class Pruner Side Pad Tight");
static double_VAR(classify_pp_angle_pad, 45.0, "Proto Pruner Angle Pad");
static double_VAR(classify_pp_end_pad, 0.5, "Proto Prune End Pad");
static double_VAR(classify_pp_side_pad, 2.5, "Proto Pruner Side Pad");
/*-----------------------------------------------------------------------------
Public Code

View File

@ -42,7 +42,7 @@ const int RecodeBeamSearch::kBeamWidths[RecodedCharID::kMaxCodeLen + 1] = {
5, 10, 16, 16, 16, 16, 16, 16, 16, 16,
};
const char* kNodeContNames[] = {"Anything", "OnlyDup", "NoDup"};
static const char* kNodeContNames[] = {"Anything", "OnlyDup", "NoDup"};
// Prints debug details of the node.
void RecodeNode::Print(int null_char, const UNICHARSET& unicharset,

View File

@ -2,7 +2,6 @@
// File: alignedblob.cpp
// Description: Subclass of BBGrid to find vertically aligned blobs.
// Author: Ray Smith
// Created: Fri Mar 21 15:03:01 PST 2008
//
// (C) Copyright 2008, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
@ -27,10 +26,10 @@
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_testregion_left, -1, "Left edge of debug reporting rectangle");
INT_VAR(textord_testregion_top, -1, "Top edge of debug reporting rectangle");
INT_VAR(textord_testregion_right, INT32_MAX, "Right edge of debug rectangle");
INT_VAR(textord_testregion_bottom, INT32_MAX, "Bottom edge of debug rectangle");
static INT_VAR(textord_testregion_left, -1, "Left edge of debug reporting rectangle");
static INT_VAR(textord_testregion_top, -1, "Top edge of debug reporting rectangle");
static INT_VAR(textord_testregion_right, INT32_MAX, "Right edge of debug rectangle");
static INT_VAR(textord_testregion_bottom, INT32_MAX, "Bottom edge of debug rectangle");
BOOL_VAR(textord_debug_printable, false, "Make debug windows printable");
namespace tesseract {

View File

@ -3,7 +3,6 @@
// Description: Class to hold BLOBNBOXs in a grid for fast access
// to neighbours.
// Author: Ray Smith
// Created: Wed Jun 06 17:22:01 PDT 2007
//
// (C) Copyright 2007, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
@ -100,7 +99,7 @@ void IntGrid::Clear() {
void IntGrid::Rotate(const FCOORD& rotation) {
ASSERT_HOST(rotation.x() == 0.0f || rotation.y() == 0.0f);
ICOORD old_bleft(bleft());
ICOORD old_tright(tright());
//ICOORD old_tright(tright());
int old_width = gridwidth();
int old_height = gridheight();
TBOX box(bleft(), tright());

View File

@ -25,9 +25,9 @@
#include <algorithm>
#include <vector> // for std::vector
BOOL_VAR(textord_space_size_is_variable, false,
"If true, word delimiter spaces are assumed to have "
"variable width, even though characters have fixed pitch.");
static BOOL_VAR(textord_space_size_is_variable, false,
"If true, word delimiter spaces are assumed to have "
"variable width, even though characters have fixed pitch.");
namespace {

View File

@ -53,15 +53,15 @@ const double kMinGutterWidthGrid = 0.5;
// adding noise blobs.
const double kMaxDistToPartSizeRatio = 1.5;
BOOL_VAR(textord_tabfind_show_initial_partitions,
false, "Show partition bounds");
BOOL_VAR(textord_tabfind_show_reject_blobs,
false, "Show blobs rejected as noise");
INT_VAR(textord_tabfind_show_partitions, 0,
"Show partition bounds, waiting if >1");
BOOL_VAR(textord_tabfind_show_columns, false, "Show column bounds");
BOOL_VAR(textord_tabfind_show_blocks, false, "Show final block bounds");
BOOL_VAR(textord_tabfind_find_tables, true, "run table detection");
static BOOL_VAR(textord_tabfind_show_initial_partitions,
false, "Show partition bounds");
static BOOL_VAR(textord_tabfind_show_reject_blobs,
false, "Show blobs rejected as noise");
static INT_VAR(textord_tabfind_show_partitions, 0,
"Show partition bounds, waiting if >1");
static BOOL_VAR(textord_tabfind_show_columns, false, "Show column bounds");
static BOOL_VAR(textord_tabfind_show_blocks, false, "Show final block bounds");
static BOOL_VAR(textord_tabfind_find_tables, true, "run table detection");
ScrollView* ColumnFinder::blocks_win_ = nullptr;

View File

@ -2,7 +2,6 @@
// File: colfind.h
// Description: Class to find columns in the grid of BLOBNBOXes.
// Author: Ray Smith
// Created: Thu Feb 21 14:04:01 PST 2008
//
// (C) Copyright 2008, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
@ -38,8 +37,6 @@ class TO_BLOCK;
namespace tesseract {
extern BOOL_VAR_H(textord_tabfind_find_tables, false, "run table detection");
class ColPartitionSet;
class ColPartitionSet_LIST;
class ColSegment_LIST;

View File

@ -2,7 +2,6 @@
// File: colpartitiongrid.cpp
// Description: Class collecting code that acts on a BBGrid of ColPartitions.
// Author: Ray Smith
// Created: Mon Oct 05 08:42:01 PDT 2009
//
// (C) Copyright 2009, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
@ -29,7 +28,7 @@
namespace tesseract {
BOOL_VAR(textord_tabfind_show_color_fit, false, "Show stroke widths");
static BOOL_VAR(textord_tabfind_show_color_fit, false, "Show stroke widths");
// Max pad factor used to search the neighbourhood of a partition to smooth
// partition types.

View File

@ -2,7 +2,6 @@
* File: edgblob.cpp (Formerly edgeloop.c)
* Description: Functions to clean up an outline before approximation.
* Author: Ray Smith
* Created: Tue Mar 26 16:56:25 GMT 1991
*
*(C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0(the "License");
@ -34,29 +33,28 @@
// - number of children exceeds edges_max_children_per_outline
// - number of nested layers exceeds edges_max_children_layers
// - joint complexity exceeds edges_children_count_limit(as in child_count())
EXTERN BOOL_VAR(edges_use_new_outline_complexity, false,
static BOOL_VAR(edges_use_new_outline_complexity, false,
"Use the new outline complexity module");
EXTERN INT_VAR(edges_max_children_per_outline, 10,
static INT_VAR(edges_max_children_per_outline, 10,
"Max number of children inside a character outline");
EXTERN INT_VAR(edges_max_children_layers, 5,
static INT_VAR(edges_max_children_layers, 5,
"Max layers of nested children inside a character outline");
EXTERN BOOL_VAR(edges_debug, false,
static BOOL_VAR(edges_debug, false,
"turn on debugging for this module");
EXTERN INT_VAR(edges_children_per_grandchild, 10,
static INT_VAR(edges_children_per_grandchild, 10,
"Importance ratio for chucking outlines");
EXTERN INT_VAR(edges_children_count_limit, 45,
static INT_VAR(edges_children_count_limit, 45,
"Max holes allowed in blob");
EXTERN BOOL_VAR(edges_children_fix, false,
static BOOL_VAR(edges_children_fix, false,
"Remove boxy parents of char-like children");
EXTERN INT_VAR(edges_min_nonhole, 12,
static INT_VAR(edges_min_nonhole, 12,
"Min pixels for potential char in box");
EXTERN INT_VAR(edges_patharea_ratio, 40,
static INT_VAR(edges_patharea_ratio, 40,
"Max lensq/area for acceptable child outline");
EXTERN double_VAR(edges_childarea, 0.5,
static double_VAR(edges_childarea, 0.5,
"Min area fraction of child outline");
EXTERN double_VAR(edges_boxarea, 0.875,
static double_VAR(edges_boxarea, 0.875,
"Min area fraction of grandchild for box");
/**

View File

@ -1,8 +1,7 @@
/**********************************************************************
* File: edgloop.h (Formerly edgeloop.h)
* Description: Functions to clean up an outline before approximation.
* Author: Ray Smith
* Created: Tue Mar 26 16:56:25 GMT 1991
* Author: Ray Smith
*
* (C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
@ -28,15 +27,6 @@
#define BUCKETSIZE 16
extern INT_VAR_H (edges_children_per_grandchild, 10,
"Importance ratio for chucking outlines");
extern INT_VAR_H (edges_children_count_limit, 45,
"Max holes allowed in blob");
extern double_VAR_H (edges_childarea, 0.5,
"Max area fraction of child outline");
extern double_VAR_H (edges_boxarea, 0.8,
"Min area fraction of grandchild for box");
void complete_edge(CRACKEDGE *start, //start of loop
C_OUTLINE_IT* outline_it);
ScrollView::Color check_path_legal( //certify outline

View File

@ -3,7 +3,6 @@
// Description: Function to find image and drawing regions in an image
// and create a corresponding list of empty blobs.
// Author: Ray Smith
// Created: Thu Mar 20 09:49:01 PDT 2008
//
// (C) Copyright 2008, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
@ -32,7 +31,7 @@
#include <algorithm>
INT_VAR(textord_tabfind_show_images, false, "Show image blobs");
static INT_VAR(textord_tabfind_show_images, false, "Show image blobs");
namespace tesseract {

View File

@ -53,17 +53,17 @@ BOOL_VAR(textord_old_xheight, false, "Use old xheight algorithm");
BOOL_VAR(textord_fix_xheight_bug, true, "Use spline baseline");
BOOL_VAR(textord_fix_makerow_bug, true, "Prevent multiple baselines");
BOOL_VAR(textord_debug_xheights, false, "Test xheight algorithms");
BOOL_VAR(textord_biased_skewcalc, true, "Bias skew estimates with line length");
BOOL_VAR(textord_interpolating_skew, true, "Interpolate across gaps");
INT_VAR(textord_skewsmooth_offset, 4, "For smooth factor");
INT_VAR(textord_skewsmooth_offset2, 1, "For smooth factor");
static BOOL_VAR(textord_biased_skewcalc, true, "Bias skew estimates with line length");
static BOOL_VAR(textord_interpolating_skew, true, "Interpolate across gaps");
static INT_VAR(textord_skewsmooth_offset, 4, "For smooth factor");
static INT_VAR(textord_skewsmooth_offset2, 1, "For smooth factor");
INT_VAR(textord_test_x, -INT32_MAX, "coord of test pt");
INT_VAR(textord_test_y, -INT32_MAX, "coord of test pt");
INT_VAR(textord_min_blobs_in_row, 4, "Min blobs before gradient counted");
INT_VAR(textord_spline_minblobs, 8, "Min blobs in each spline segment");
INT_VAR(textord_spline_medianwin, 6, "Size of window for spline segmentation");
INT_VAR(textord_max_blob_overlaps, 4,
"Max number of blobs a big blob can overlap");
static INT_VAR(textord_max_blob_overlaps, 4,
"Max number of blobs a big blob can overlap");
INT_VAR(textord_min_xheight, 10, "Min credible pixel xheight");
double_VAR(textord_spline_shift_fraction, 0.02,
"Fraction of line spacing for quad");
@ -74,9 +74,9 @@ double_VAR(textord_skew_lag, 0.02, "Lag for skew on row accumulation");
double_VAR(textord_linespace_iqrlimit, 0.2, "Max iqr/median for linespace");
double_VAR(textord_width_limit, 8, "Max width of blobs to make rows");
double_VAR(textord_chop_width, 1.5, "Max width before chopping");
double_VAR(textord_expansion_factor, 1.0,
"Factor to expand rows by in expand_rows");
double_VAR(textord_overlap_x, 0.375, "Fraction of linespace for good overlap");
static double_VAR(textord_expansion_factor, 1.0,
"Factor to expand rows by in expand_rows");
static double_VAR(textord_overlap_x, 0.375, "Fraction of linespace for good overlap");
double_VAR(textord_minxh, 0.25, "fraction of linesize for min xheight");
double_VAR(textord_min_linesize, 1.25, "* blob height for initial linesize");
double_VAR(textord_excess_blobsize, 1.3,
@ -89,8 +89,8 @@ double_VAR(textord_xheight_mode_fraction, 0.4,
"Min pile height to make xheight");
double_VAR(textord_ascheight_mode_fraction, 0.08,
"Min pile height to make ascheight");
double_VAR(textord_descheight_mode_fraction, 0.08,
"Min pile height to make descheight");
static double_VAR(textord_descheight_mode_fraction, 0.08,
"Min pile height to make descheight");
double_VAR(textord_ascx_ratio_min, 1.25, "Min cap/xheight");
double_VAR(textord_ascx_ratio_max, 1.8, "Max cap/xheight");
double_VAR(textord_descx_ratio_min, 0.25, "Min desc/xheight");

View File

@ -36,22 +36,22 @@
#define EXTERN
EXTERN BOOL_VAR (textord_really_old_xheight, false,
static BOOL_VAR (textord_really_old_xheight, false,
"Use original wiseowl xheight");
EXTERN BOOL_VAR (textord_oldbl_debug, false, "Debug old baseline generation");
EXTERN BOOL_VAR (textord_debug_baselines, false, "Debug baseline generation");
EXTERN BOOL_VAR (textord_oldbl_paradef, true, "Use para default mechanism");
EXTERN BOOL_VAR (textord_oldbl_split_splines, true, "Split stepped splines");
EXTERN BOOL_VAR (textord_oldbl_merge_parts, true, "Merge suspect partitions");
EXTERN BOOL_VAR (oldbl_corrfix, true, "Improve correlation of heights");
EXTERN BOOL_VAR (oldbl_xhfix, false,
static BOOL_VAR (textord_debug_baselines, false, "Debug baseline generation");
static BOOL_VAR (textord_oldbl_paradef, true, "Use para default mechanism");
static BOOL_VAR (textord_oldbl_split_splines, true, "Split stepped splines");
static BOOL_VAR (textord_oldbl_merge_parts, true, "Merge suspect partitions");
static BOOL_VAR (oldbl_corrfix, true, "Improve correlation of heights");
static BOOL_VAR (oldbl_xhfix, false,
"Fix bug in modes threshold for xheights");
EXTERN BOOL_VAR(textord_ocropus_mode, false, "Make baselines for ocropus");
EXTERN double_VAR (oldbl_xhfract, 0.4, "Fraction of est allowed in calc");
EXTERN INT_VAR (oldbl_holed_losscount, 10,
static BOOL_VAR(textord_ocropus_mode, false, "Make baselines for ocropus");
static double_VAR (oldbl_xhfract, 0.4, "Fraction of est allowed in calc");
static INT_VAR (oldbl_holed_losscount, 10,
"Max lost before fallback line used");
EXTERN double_VAR (oldbl_dot_error_size, 1.26, "Max aspect ratio of a dot");
EXTERN double_VAR (textord_oldbl_jumplimit, 0.15,
static double_VAR (oldbl_dot_error_size, 1.26, "Max aspect ratio of a dot");
static double_VAR (textord_oldbl_jumplimit, 0.15,
"X fraction for new partition");
#define TURNLIMIT 1 /*min size for turning point */

View File

@ -22,24 +22,9 @@
#include "params.h"
#include "blobbox.h"
extern BOOL_VAR_H (textord_really_old_xheight, false,
"Use original wiseowl xheight");
extern BOOL_VAR_H (textord_oldbl_debug, false,
"Debug old baseline generation");
extern BOOL_VAR_H (textord_debug_baselines, false,
"Debug baseline generation");
extern BOOL_VAR_H (textord_oldbl_paradef, true, "Use para default mechanism");
extern BOOL_VAR_H (textord_oldbl_split_splines, true,
"Split stepped splines");
extern BOOL_VAR_H (textord_oldbl_merge_parts, true,
"Merge suspect partitions");
extern BOOL_VAR_H (oldbl_xhfix, false,
"Fix bug in modes threshold for xheights");
extern INT_VAR_H (oldbl_holed_losscount, 10,
"Max lost before fallback line used");
extern double_VAR_H (oldbl_dot_error_size, 1.26, "Max aspect ratio of a dot");
extern double_VAR_H (textord_oldbl_jumplimit, 0.15,
"X fraction for new partition");
int get_blob_coords( //get boxes
TO_ROW* row, //row to use
int32_t lineheight, //block level

View File

@ -2,7 +2,6 @@
// File: strokewidth.cpp
// Description: Subclass of BBGrid to find uniformity of strokewidth.
// Author: Ray Smith
// Created: Mon Mar 31 16:17:01 PST 2008
//
// (C) Copyright 2008, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
@ -38,8 +37,8 @@
namespace tesseract {
INT_VAR(textord_tabfind_show_strokewidths, 0, "Show stroke widths");
BOOL_VAR(textord_tabfind_only_strokewidths, false, "Only run stroke widths");
static INT_VAR(textord_tabfind_show_strokewidths, 0, "Show stroke widths");
static BOOL_VAR(textord_tabfind_only_strokewidths, false, "Only run stroke widths");
/** Allowed proportional change in stroke width to be the same font. */
const double kStrokeWidthFractionTolerance = 0.125;

View File

@ -2,7 +2,6 @@
// File: tabfind.cpp
// Description: Subclass of BBGrid to find vertically aligned blobs.
// Author: Ray Smith
// Created: Fri Mar 21 15:03:01 PST 2008
//
// (C) Copyright 2008, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
@ -60,8 +59,8 @@ const int kMinEvaluatedTabs = 3;
// so that the assert there never fails.
const double kCosMaxSkewAngle = 0.866025;
BOOL_VAR(textord_tabfind_show_initialtabs, false, "Show tab candidates");
BOOL_VAR(textord_tabfind_show_finaltabs, false, "Show tab vectors");
static BOOL_VAR(textord_tabfind_show_initialtabs, false, "Show tab candidates");
static BOOL_VAR(textord_tabfind_show_finaltabs, false, "Show tab vectors");
TabFind::TabFind(int gridsize, const ICOORD& bleft, const ICOORD& tright,
TabVector_LIST* vlines, int vertical_x, int vertical_y,

View File

@ -2,7 +2,6 @@
// File: tablefind.cpp
// Description: Helper classes to find tables from ColPartitions.
// Author: Faisal Shafait (faisal.shafait@dfki.de)
// Created: Tue Jan 06 11:13:01 PST 2009
//
// (C) Copyright 2009, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
@ -90,7 +89,7 @@ const double kTableColumnThreshold = 3.0;
// Search for horizontal ruling lines within the vertical margin as a
// multiple of grid size
const int kRulingVerticalMargin = 3;
// const int kRulingVerticalMargin = 3;
// Minimum overlap that a colpartition must have with a table region
// to become part of that table
@ -140,13 +139,13 @@ const double kMaxXProjectionGapFactor = 2.0;
const double kStrokeWidthFractionalTolerance = 0.25;
const double kStrokeWidthConstantTolerance = 2.0;
BOOL_VAR(textord_show_tables, false, "Show table regions");
BOOL_VAR(textord_tablefind_show_mark, false,
"Debug table marking steps in detail");
BOOL_VAR(textord_tablefind_show_stats, false,
"Show page stats used in table finding");
BOOL_VAR(textord_tablefind_recognize_tables, false,
"Enables the table recognizer for table layout and filtering.");
static BOOL_VAR(textord_show_tables, false, "Show table regions");
static BOOL_VAR(textord_tablefind_show_mark, false,
"Debug table marking steps in detail");
static BOOL_VAR(textord_tablefind_show_stats, false,
"Show page stats used in table finding");
static BOOL_VAR(textord_tablefind_recognize_tables, false,
"Enables the table recognizer for table layout and filtering.");
ELISTIZE(ColSegment)
CLISTIZE(ColSegment)

View File

@ -2,7 +2,6 @@
// File: tabvector.cpp
// Description: Class to hold a near-vertical vector representing a tab-stop.
// Author: Ray Smith
// Created: Thu Apr 10 16:28:01 PST 2008
//
// (C) Copyright 2008, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
@ -507,7 +506,7 @@ bool TabVector::IsAPartner(const TabVector* other) {
}
// These names must be synced with the TabAlignment enum in tabvector.h.
const char* kAlignmentNames[] = {
static const char* const kAlignmentNames[] = {
"Left Aligned",
"Left Ragged",
"Center",

View File

@ -36,10 +36,10 @@
#define EXTERN
EXTERN BOOL_VAR (textord_all_prop, false, "All doc is proportial text");
static BOOL_VAR (textord_all_prop, false, "All doc is proportial text");
EXTERN BOOL_VAR (textord_debug_pitch_test, false,
"Debug on fixed pitch test");
EXTERN BOOL_VAR (textord_disable_pitch_test, false,
static BOOL_VAR (textord_disable_pitch_test, false,
"Turn off dp fixed pitch algorithm");
EXTERN BOOL_VAR (textord_fast_pitch_test, false,
"Do even faster pitch algorithm");

View File

@ -29,10 +29,9 @@
#include "tessclassifier.h"
#include "tesseractclass.h"
STRING_PARAM_FLAG(classifier, "", "Classifier to test");
STRING_PARAM_FLAG(lang, "eng", "Language to test");
STRING_PARAM_FLAG(tessdata_dir, "", "Directory of traineddata files");
DECLARE_INT_PARAM_FLAG(debug_level);
static STRING_PARAM_FLAG(classifier, "", "Classifier to test");
static STRING_PARAM_FLAG(lang, "eng", "Language to test");
static STRING_PARAM_FLAG(tessdata_dir, "", "Directory of traineddata files");
enum ClassifierName {
CN_PRUNER,

View File

@ -1,13 +1,9 @@
/******************************************************************************
** Filename: cntraining.cpp
** Purpose: Generates a normproto and pffmtable.
** Author: Dan Johnson
** Revisment: Christy Russon
** History: Fri Aug 18 08:53:50 1989, DSJ, Created.
** 5/25/90, DSJ, Adapted to multiple feature types.
** Tuesday, May 17, 1998 Changes made to make feature specific and
** simplify structures. First step in simplifying training process.
**
** Filename: cntraining.cpp
** Purpose: Generates a normproto and pffmtable.
** Author: Dan Johnson
** Revisment: Christy Russon
**
** (c) Copyright Hewlett-Packard Company, 1988.
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
@ -37,8 +33,6 @@
#define PROGRAM_FEATURE_TYPE "cn"
DECLARE_STRING_PARAM_FLAG(D);
/*----------------------------------------------------------------------------
Private Function Prototypes
----------------------------------------------------------------------------*/
@ -54,15 +48,14 @@ static void WriteProtos(FILE* File, uint16_t N, LIST ProtoList,
----------------------------------------------------------------------------*/
/* global variable to hold configuration parameters to control clustering */
//-M 0.025 -B 0.05 -I 0.8 -C 1e-3
CLUSTERCONFIG CNConfig =
{
static const CLUSTERCONFIG CNConfig = {
elliptical, 0.025, 0.05, 0.8, 1e-3, 0
};
/*----------------------------------------------------------------------------
Public Code
----------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/**
* This program reads in a text file consisting of feature
* samples from a training page in the following format:

View File

@ -22,22 +22,22 @@
#include "tprintf.h"
#include "unicharset_training_utils.h"
STRING_PARAM_FLAG(input_unicharset, "",
"Filename with unicharset to complete and use in encoding");
STRING_PARAM_FLAG(script_dir, "",
"Directory name for input script unicharsets");
STRING_PARAM_FLAG(words, "",
"File listing words to use for the system dictionary");
STRING_PARAM_FLAG(puncs, "", "File listing punctuation patterns");
STRING_PARAM_FLAG(numbers, "", "File listing number patterns");
STRING_PARAM_FLAG(output_dir, "", "Root directory for output files");
STRING_PARAM_FLAG(version_str, "", "Version string to add to traineddata file");
STRING_PARAM_FLAG(lang, "", "Name of language being processed");
BOOL_PARAM_FLAG(lang_is_rtl, false,
"True if lang being processed is written right-to-left");
BOOL_PARAM_FLAG(pass_through_recoder, false,
"If true, the recoder is a simple pass-through of the"
" unicharset. Otherwise, potentially a compression of it");
static STRING_PARAM_FLAG(input_unicharset, "",
"Filename with unicharset to complete and use in encoding");
static STRING_PARAM_FLAG(script_dir, "",
"Directory name for input script unicharsets");
static STRING_PARAM_FLAG(words, "",
"File listing words to use for the system dictionary");
static STRING_PARAM_FLAG(puncs, "", "File listing punctuation patterns");
static STRING_PARAM_FLAG(numbers, "", "File listing number patterns");
static STRING_PARAM_FLAG(output_dir, "", "Root directory for output files");
static STRING_PARAM_FLAG(version_str, "", "Version string to add to traineddata file");
static STRING_PARAM_FLAG(lang, "", "Name of language being processed");
static BOOL_PARAM_FLAG(lang_is_rtl, false,
"True if lang being processed is written right-to-left");
static BOOL_PARAM_FLAG(pass_through_recoder, false,
"If true, the recoder is a simple pass-through of the "
"unicharset. Otherwise, potentially a compression of it");
int main(int argc, char** argv) {
// Sets properties on the input unicharset file, and writes:

View File

@ -62,6 +62,16 @@
#endif
// Flags from commontraining.cpp
DECLARE_INT_PARAM_FLAG(debug_level);
DECLARE_STRING_PARAM_FLAG(D);
DECLARE_STRING_PARAM_FLAG(O);
DECLARE_STRING_PARAM_FLAG(U);
DECLARE_STRING_PARAM_FLAG(X);
DECLARE_STRING_PARAM_FLAG(fonts_dir);
DECLARE_STRING_PARAM_FLAG(fontconfig_tmpdir);
DECLARE_STRING_PARAM_FLAG(test_ch);
namespace tesseract {
// Parse commandline flags and values. Prints the usage string and exits on

View File

@ -87,27 +87,27 @@ using tesseract::ShapeTable;
// -M 0.625 -B 0.05 -I 1.0 -C 1e-6.
CLUSTERCONFIG Config = { elliptical, 0.625, 0.05, 1.0, 1e-6, 0 };
FEATURE_DEFS_STRUCT feature_defs;
CCUtil ccutil;
static CCUtil ccutil;
INT_PARAM_FLAG(debug_level, 0, "Level of Trainer debugging");
INT_PARAM_FLAG(load_images, 0, "Load images with tr files");
STRING_PARAM_FLAG(configfile, "", "File to load more configs from");
static INT_PARAM_FLAG(load_images, 0, "Load images with tr files");
static STRING_PARAM_FLAG(configfile, "", "File to load more configs from");
STRING_PARAM_FLAG(D, "", "Directory to write output files to");
STRING_PARAM_FLAG(F, "font_properties", "File listing font properties");
static STRING_PARAM_FLAG(F, "font_properties", "File listing font properties");
STRING_PARAM_FLAG(X, "", "File listing font xheights");
STRING_PARAM_FLAG(U, "unicharset", "File to load unicharset from");
STRING_PARAM_FLAG(O, "", "File to write unicharset to");
STRING_PARAM_FLAG(output_trainer, "", "File to write trainer to");
static STRING_PARAM_FLAG(output_trainer, "", "File to write trainer to");
STRING_PARAM_FLAG(test_ch, "", "UTF8 test character string");
DOUBLE_PARAM_FLAG(clusterconfig_min_samples_fraction, Config.MinSamples,
"Min number of samples per proto as % of total");
DOUBLE_PARAM_FLAG(clusterconfig_max_illegal, Config.MaxIllegal,
"Max percentage of samples in a cluster which have more"
" than 1 feature in that cluster");
DOUBLE_PARAM_FLAG(clusterconfig_independence, Config.Independence,
"Desired independence between dimensions");
DOUBLE_PARAM_FLAG(clusterconfig_confidence, Config.Confidence,
"Desired confidence in prototypes created");
static DOUBLE_PARAM_FLAG(clusterconfig_min_samples_fraction, Config.MinSamples,
"Min number of samples per proto as % of total");
static DOUBLE_PARAM_FLAG(clusterconfig_max_illegal, Config.MaxIllegal,
"Max percentage of samples in a cluster which have more"
" than 1 feature in that cluster");
static DOUBLE_PARAM_FLAG(clusterconfig_independence, Config.Independence,
"Desired independence between dimensions");
static DOUBLE_PARAM_FLAG(clusterconfig_confidence, Config.Confidence,
"Desired confidence in prototypes created");
/**
* This routine parses the command line arguments that were

View File

@ -2,7 +2,6 @@
// File: lstmeval.cpp
// Description: Evaluation program for LSTM-based networks.
// Author: Ray Smith
// Created: Wed Nov 23 12:20:06 PST 2016
//
// (C) Copyright 2016, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
@ -25,15 +24,15 @@
#include "strngs.h"
#include "tprintf.h"
STRING_PARAM_FLAG(model, "", "Name of model file (training or recognition)");
STRING_PARAM_FLAG(traineddata, "",
"If model is a training checkpoint, then traineddata must "
"be the traineddata file that was given to the trainer");
STRING_PARAM_FLAG(eval_listfile, "",
"File listing sample files in lstmf training format.");
INT_PARAM_FLAG(max_image_MB, 2000, "Max memory to use for images.");
INT_PARAM_FLAG(verbosity, 1,
"Amount of diagnosting information to output (0-2).");
static STRING_PARAM_FLAG(model, "", "Name of model file (training or recognition)");
static STRING_PARAM_FLAG(traineddata, "",
"If model is a training checkpoint, then traineddata must "
"be the traineddata file that was given to the trainer");
static STRING_PARAM_FLAG(eval_listfile, "",
"File listing sample files in lstmf training format.");
static INT_PARAM_FLAG(max_image_MB, 2000, "Max memory to use for images.");
static INT_PARAM_FLAG(verbosity, 1,
"Amount of diagnosting information to output (0-2).");
int main(int argc, char **argv) {
tesseract::CheckSharedLibraryVersion();

View File

@ -2,7 +2,6 @@
// File: lstmtraining.cpp
// Description: Training program for LSTM-based networks.
// Author: Ray Smith
// Created: Fri May 03 11:05:06 PST 2013
//
// (C) Copyright 2013, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
@ -28,41 +27,41 @@
#include "tprintf.h"
#include "unicharset_training_utils.h"
INT_PARAM_FLAG(debug_interval, 0, "How often to display the alignment.");
STRING_PARAM_FLAG(net_spec, "", "Network specification");
INT_PARAM_FLAG(net_mode, 192, "Controls network behavior.");
INT_PARAM_FLAG(perfect_sample_delay, 0,
"How many imperfect samples between perfect ones.");
DOUBLE_PARAM_FLAG(target_error_rate, 0.01, "Final error rate in percent.");
DOUBLE_PARAM_FLAG(weight_range, 0.1, "Range of initial random weights.");
DOUBLE_PARAM_FLAG(learning_rate, 10.0e-4, "Weight factor for new deltas.");
DOUBLE_PARAM_FLAG(momentum, 0.5, "Decay factor for repeating deltas.");
DOUBLE_PARAM_FLAG(adam_beta, 0.999, "Decay factor for repeating deltas.");
INT_PARAM_FLAG(max_image_MB, 6000, "Max memory to use for images.");
STRING_PARAM_FLAG(continue_from, "", "Existing model to extend");
STRING_PARAM_FLAG(model_output, "lstmtrain", "Basename for output models");
STRING_PARAM_FLAG(train_listfile, "",
"File listing training files in lstmf training format.");
STRING_PARAM_FLAG(eval_listfile, "",
"File listing eval files in lstmf training format.");
BOOL_PARAM_FLAG(stop_training, false,
"Just convert the training model to a runtime model.");
BOOL_PARAM_FLAG(convert_to_int, false,
"Convert the recognition model to an integer model.");
BOOL_PARAM_FLAG(sequential_training, false,
"Use the training files sequentially instead of round-robin.");
INT_PARAM_FLAG(append_index, -1, "Index in continue_from Network at which to"
" attach the new network defined by net_spec");
BOOL_PARAM_FLAG(debug_network, false,
"Get info on distribution of weight values");
INT_PARAM_FLAG(max_iterations, 0, "If set, exit after this many iterations");
STRING_PARAM_FLAG(traineddata, "",
"Combined Dawgs/Unicharset/Recoder for language model");
STRING_PARAM_FLAG(old_traineddata, "",
"When changing the character set, this specifies the old"
" character set that is to be replaced");
BOOL_PARAM_FLAG(randomly_rotate, false,
"Train OSD and randomly turn training samples upside-down");
static INT_PARAM_FLAG(debug_interval, 0, "How often to display the alignment.");
static STRING_PARAM_FLAG(net_spec, "", "Network specification");
static INT_PARAM_FLAG(net_mode, 192, "Controls network behavior.");
static INT_PARAM_FLAG(perfect_sample_delay, 0,
"How many imperfect samples between perfect ones.");
static DOUBLE_PARAM_FLAG(target_error_rate, 0.01, "Final error rate in percent.");
static DOUBLE_PARAM_FLAG(weight_range, 0.1, "Range of initial random weights.");
static DOUBLE_PARAM_FLAG(learning_rate, 10.0e-4, "Weight factor for new deltas.");
static DOUBLE_PARAM_FLAG(momentum, 0.5, "Decay factor for repeating deltas.");
static DOUBLE_PARAM_FLAG(adam_beta, 0.999, "Decay factor for repeating deltas.");
static INT_PARAM_FLAG(max_image_MB, 6000, "Max memory to use for images.");
static STRING_PARAM_FLAG(continue_from, "", "Existing model to extend");
static STRING_PARAM_FLAG(model_output, "lstmtrain", "Basename for output models");
static STRING_PARAM_FLAG(train_listfile, "",
"File listing training files in lstmf training format.");
static STRING_PARAM_FLAG(eval_listfile, "",
"File listing eval files in lstmf training format.");
static BOOL_PARAM_FLAG(stop_training, false,
"Just convert the training model to a runtime model.");
static BOOL_PARAM_FLAG(convert_to_int, false,
"Convert the recognition model to an integer model.");
static BOOL_PARAM_FLAG(sequential_training, false,
"Use the training files sequentially instead of round-robin.");
static INT_PARAM_FLAG(append_index, -1, "Index in continue_from Network at which to"
" attach the new network defined by net_spec");
static BOOL_PARAM_FLAG(debug_network, false,
"Get info on distribution of weight values");
static INT_PARAM_FLAG(max_iterations, 0, "If set, exit after this many iterations");
static STRING_PARAM_FLAG(traineddata, "",
"Combined Dawgs/Unicharset/Recoder for language model");
static STRING_PARAM_FLAG(old_traineddata, "",
"When changing the character set, this specifies the old"
" character set that is to be replaced");
static BOOL_PARAM_FLAG(randomly_rotate, false,
"Train OSD and randomly turn training samples upside-down");
// Number of training images to train between calls to MaintainCheckpoints.
const int kNumPagesPerBatch = 100;

View File

@ -33,18 +33,18 @@
#include "params.h"
/*-------------------once in subfeat---------------------------------*/
double_VAR(training_angle_match_scale, 1.0, "Angle Match Scale ...");
static double_VAR(training_angle_match_scale, 1.0, "Angle Match Scale ...");
double_VAR(training_similarity_midpoint, 0.0075, "Similarity Midpoint ...");
static double_VAR(training_similarity_midpoint, 0.0075, "Similarity Midpoint ...");
double_VAR(training_similarity_curl, 2.0, "Similarity Curl ...");
static double_VAR(training_similarity_curl, 2.0, "Similarity Curl ...");
/*-----------------------------once in fasttrain----------------------------------*/
double_VAR(training_tangent_bbox_pad, 0.5, "Tangent bounding box pad ...");
static double_VAR(training_tangent_bbox_pad, 0.5, "Tangent bounding box pad ...");
double_VAR(training_orthogonal_bbox_pad, 2.5, "Orthogonal bounding box pad ...");
static double_VAR(training_orthogonal_bbox_pad, 2.5, "Orthogonal bounding box pad ...");
double_VAR(training_angle_pad, 45.0, "Angle pad ...");
static double_VAR(training_angle_pad, 45.0, "Angle pad ...");
/**
* Compare protos p1 and p2 and return an estimate of the

View File

@ -60,8 +60,6 @@ using tesseract::ShapeTable;
// Max length of a fake shape label.
const int kMaxShapeLabelLength = 10;
DECLARE_STRING_PARAM_FLAG(test_ch);
/*----------------------------------------------------------------------------
Public Code
-----------------------------------------------------------------------------*/

View File

@ -31,9 +31,6 @@
#include "pango/pangocairo.h"
#include "util.h"
DECLARE_STRING_PARAM_FLAG(fonts_dir);
DECLARE_STRING_PARAM_FLAG(fontconfig_tmpdir);
using char32 = signed int;
namespace tesseract {

View File

@ -18,13 +18,8 @@
#include "unicharset_training_utils.h"
// The directory that is searched for universal script unicharsets.
STRING_PARAM_FLAG(script_dir, "",
"Directory name for input script unicharsets/xheights");
// Flags from commontraining.cpp
DECLARE_STRING_PARAM_FLAG(U);
DECLARE_STRING_PARAM_FLAG(O);
DECLARE_STRING_PARAM_FLAG(X);
static STRING_PARAM_FLAG(script_dir, "",
"Directory name for input script unicharsets/xheights");
int main(int argc, char** argv) {
tesseract::CheckSharedLibraryVersion();

View File

@ -28,12 +28,12 @@
#include "params.h"
#include "strngs.h"
INT_PARAM_FLAG(display_cloud_font, -1,
"Display cloud of this font, canonical_class1");
INT_PARAM_FLAG(display_canonical_font, -1,
"Display canonical sample of this font, canonical_class2");
STRING_PARAM_FLAG(canonical_class1, "", "Class to show ambigs for");
STRING_PARAM_FLAG(canonical_class2, "", "Class to show ambigs for");
static INT_PARAM_FLAG(display_cloud_font, -1,
"Display cloud of this font, canonical_class1");
static INT_PARAM_FLAG(display_canonical_font, -1,
"Display canonical sample of this font, canonical_class2");
static STRING_PARAM_FLAG(canonical_class1, "", "Class to show ambigs for");
static STRING_PARAM_FLAG(canonical_class2, "", "Class to show ambigs for");
// Loads training data, if requested displays debug information, otherwise
// creates the master shape table by shape clustering and writes it to a file.

View File

@ -11,9 +11,7 @@
* the appropriate --fonts_dir path.
* Specifying --use_only_legacy_fonts will restrict the available
* fonts to those listed in legacy_fonts.h
*
* Authors: Ranjith Unnikrishnan, Ray Smith
* Created: Tue Nov 19 2013
*
* (C) Copyright 2013, Google Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
@ -58,140 +56,144 @@
const int kRandomSeed = 0x18273645;
// The text input file.
STRING_PARAM_FLAG(text, "", "File name of text input to process");
static STRING_PARAM_FLAG(text, "", "File name of text input to process");
// The text output file.
STRING_PARAM_FLAG(outputbase, "", "Basename for output image/box file");
static STRING_PARAM_FLAG(outputbase, "", "Basename for output image/box file");
// Degrade the rendered image to mimic scanner quality.
BOOL_PARAM_FLAG(degrade_image, true,
"Degrade rendered image with speckle noise, dilation/erosion "
"and rotation");
static BOOL_PARAM_FLAG(degrade_image, true,
"Degrade rendered image with speckle noise, dilation/erosion "
"and rotation");
// Rotate the rendered image to have more realistic glyph borders
BOOL_PARAM_FLAG(rotate_image, true, "Rotate the image in a random way.");
static BOOL_PARAM_FLAG(rotate_image, true, "Rotate the image in a random way.");
// Degradation to apply to the image.
INT_PARAM_FLAG(exposure, 0, "Exposure level in photocopier");
static INT_PARAM_FLAG(exposure, 0, "Exposure level in photocopier");
// Distort the rendered image by various means according to the bool flags.
BOOL_PARAM_FLAG(distort_image, false,
"Degrade rendered image with noise, blur, invert.");
static BOOL_PARAM_FLAG(distort_image, false,
"Degrade rendered image with noise, blur, invert.");
// Distortion to apply to the image.
BOOL_PARAM_FLAG(invert, true, "Invert the image");
static BOOL_PARAM_FLAG(invert, true, "Invert the image");
// Distortion to apply to the image.
BOOL_PARAM_FLAG(white_noise, true, "Add Gaussian Noise");
static BOOL_PARAM_FLAG(white_noise, true, "Add Gaussian Noise");
// Distortion to apply to the image.
BOOL_PARAM_FLAG(smooth_noise, true, "Smoothen Noise");
static BOOL_PARAM_FLAG(smooth_noise, true, "Smoothen Noise");
// Distortion to apply to the image.
BOOL_PARAM_FLAG(blur, true, "Blur the image");
static BOOL_PARAM_FLAG(blur, true, "Blur the image");
#if 0
// Distortion to apply to the image.
//BOOL_PARAM_FLAG(perspective, false, "Generate Perspective Distortion");
static BOOL_PARAM_FLAG(perspective, false, "Generate Perspective Distortion");
// Distortion to apply to the image.
//INT_PARAM_FLAG(box_reduction, 0, "Integer reduction factor box_scale");
static INT_PARAM_FLAG(box_reduction, 0, "Integer reduction factor box_scale");
#endif
// Output image resolution.
INT_PARAM_FLAG(resolution, 300, "Pixels per inch");
static INT_PARAM_FLAG(resolution, 300, "Pixels per inch");
// Width of output image (in pixels).
INT_PARAM_FLAG(xsize, 3600, "Width of output image");
static INT_PARAM_FLAG(xsize, 3600, "Width of output image");
// Max height of output image (in pixels).
INT_PARAM_FLAG(ysize, 4800, "Height of output image");
static INT_PARAM_FLAG(ysize, 4800, "Height of output image");
// Max number of pages to produce.
INT_PARAM_FLAG(max_pages, 0, "Maximum number of pages to output (0=unlimited)");
static INT_PARAM_FLAG(max_pages, 0, "Maximum number of pages to output (0=unlimited)");
// Margin around text (in pixels).
INT_PARAM_FLAG(margin, 100, "Margin round edges of image");
static INT_PARAM_FLAG(margin, 100, "Margin round edges of image");
// Size of text (in points).
INT_PARAM_FLAG(ptsize, 12, "Size of printed text");
static INT_PARAM_FLAG(ptsize, 12, "Size of printed text");
// Inter-character space (in ems).
DOUBLE_PARAM_FLAG(char_spacing, 0, "Inter-character space in ems");
static DOUBLE_PARAM_FLAG(char_spacing, 0, "Inter-character space in ems");
// Sets the probability (value in [0, 1]) of starting to render a word with an
// underline. Words are assumed to be space-delimited.
DOUBLE_PARAM_FLAG(underline_start_prob, 0,
"Fraction of words to underline (value in [0,1])");
static DOUBLE_PARAM_FLAG(underline_start_prob, 0,
"Fraction of words to underline (value in [0,1])");
// Set the probability (value in [0, 1]) of continuing a started underline to
// the next word.
DOUBLE_PARAM_FLAG(underline_continuation_prob, 0,
"Fraction of words to underline (value in [0,1])");
static DOUBLE_PARAM_FLAG(underline_continuation_prob, 0,
"Fraction of words to underline (value in [0,1])");
// Inter-line space (in pixels).
INT_PARAM_FLAG(leading, 12, "Inter-line space (in pixels)");
static INT_PARAM_FLAG(leading, 12, "Inter-line space (in pixels)");
// Layout and glyph orientation on rendering.
STRING_PARAM_FLAG(writing_mode, "horizontal",
"Specify one of the following writing"
" modes.\n"
"'horizontal' : Render regular horizontal text. (default)\n"
"'vertical' : Render vertical text. Glyph orientation is"
" selected by Pango.\n"
"'vertical-upright' : Render vertical text. Glyph "
" orientation is set to be upright.");
static STRING_PARAM_FLAG(writing_mode, "horizontal",
"Specify one of the following writing"
" modes.\n"
"'horizontal' : Render regular horizontal text. (default)\n"
"'vertical' : Render vertical text. Glyph orientation is"
" selected by Pango.\n"
"'vertical-upright' : Render vertical text. Glyph "
" orientation is set to be upright.");
INT_PARAM_FLAG(box_padding, 0, "Padding around produced bounding boxes");
static INT_PARAM_FLAG(box_padding, 0, "Padding around produced bounding boxes");
BOOL_PARAM_FLAG(strip_unrenderable_words, true,
"Remove unrenderable words from source text");
static BOOL_PARAM_FLAG(strip_unrenderable_words, true,
"Remove unrenderable words from source text");
// Font name.
STRING_PARAM_FLAG(font, "Arial", "Font description name to use");
static STRING_PARAM_FLAG(font, "Arial", "Font description name to use");
BOOL_PARAM_FLAG(ligatures, false,
"Rebuild and render ligatures");
static BOOL_PARAM_FLAG(ligatures, false,
"Rebuild and render ligatures");
BOOL_PARAM_FLAG(find_fonts, false,
"Search for all fonts that can render the text");
BOOL_PARAM_FLAG(render_per_font, true,
"If find_fonts==true, render each font to its own image. "
"Image filenames are of the form output_name.font_name.tif");
DOUBLE_PARAM_FLAG(min_coverage, 1.0,
"If find_fonts==true, the minimum coverage the font has of "
"the characters in the text file to include it, between "
"0 and 1.");
static BOOL_PARAM_FLAG(find_fonts, false,
"Search for all fonts that can render the text");
static BOOL_PARAM_FLAG(render_per_font, true,
"If find_fonts==true, render each font to its own image. "
"Image filenames are of the form output_name.font_name.tif");
static DOUBLE_PARAM_FLAG(min_coverage, 1.0,
"If find_fonts==true, the minimum coverage the font has of "
"the characters in the text file to include it, between "
"0 and 1.");
BOOL_PARAM_FLAG(list_available_fonts, false, "List available fonts and quit.");
static BOOL_PARAM_FLAG(list_available_fonts, false, "List available fonts and quit.");
BOOL_PARAM_FLAG(render_ngrams, false, "Put each space-separated entity from the"
" input file into one bounding box. The ngrams in the input"
" file will be randomly permuted before rendering (so that"
" there is sufficient variety of characters on each line).");
static BOOL_PARAM_FLAG(render_ngrams, false, "Put each space-separated entity from the"
" input file into one bounding box. The ngrams in the input"
" file will be randomly permuted before rendering (so that"
" there is sufficient variety of characters on each line).");
BOOL_PARAM_FLAG(output_word_boxes, false,
"Output word bounding boxes instead of character boxes. "
"This is used for Cube training, and implied by "
"--render_ngrams.");
static BOOL_PARAM_FLAG(output_word_boxes, false,
"Output word bounding boxes instead of character boxes. "
"This is used for Cube training, and implied by "
"--render_ngrams.");
STRING_PARAM_FLAG(unicharset_file, "",
"File with characters in the unicharset. If --render_ngrams"
" is true and --unicharset_file is specified, ngrams with"
" characters that are not in unicharset will be omitted");
static STRING_PARAM_FLAG(unicharset_file, "",
"File with characters in the unicharset. If --render_ngrams"
" is true and --unicharset_file is specified, ngrams with"
" characters that are not in unicharset will be omitted");
BOOL_PARAM_FLAG(bidirectional_rotation, false,
"Rotate the generated characters both ways.");
static BOOL_PARAM_FLAG(bidirectional_rotation, false,
"Rotate the generated characters both ways.");
BOOL_PARAM_FLAG(only_extract_font_properties, false,
"Assumes that the input file contains a list of ngrams. Renders"
" each ngram, extracts spacing properties and records them in"
" output_base/[font_name].fontinfo file.");
static BOOL_PARAM_FLAG(only_extract_font_properties, false,
"Assumes that the input file contains a list of ngrams. Renders"
" each ngram, extracts spacing properties and records them in"
" output_base/[font_name].fontinfo file.");
// Use these flags to output zero-padded, square individual character images
BOOL_PARAM_FLAG(output_individual_glyph_images, false,
"If true also outputs individual character images");
INT_PARAM_FLAG(glyph_resized_size, 0,
"Each glyph is square with this side length in pixels");
INT_PARAM_FLAG(glyph_num_border_pixels_to_pad, 0,
"Final_size=glyph_resized_size+2*glyph_num_border_pixels_to_pad");
static BOOL_PARAM_FLAG(output_individual_glyph_images, false,
"If true also outputs individual character images");
static INT_PARAM_FLAG(glyph_resized_size, 0,
"Each glyph is square with this side length in pixels");
static INT_PARAM_FLAG(glyph_num_border_pixels_to_pad, 0,
"Final_size=glyph_resized_size+2*glyph_num_border_pixels_to_pad");
namespace tesseract {

View File

@ -2,7 +2,6 @@
// File: unicharset_extractor.cpp
// Description: Unicode character/ligature set extractor.
// Author: Thomas Kielbus
// Created: Wed Jun 28 17:05:01 PDT 2006
//
// (C) Copyright 2006, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
@ -32,10 +31,10 @@
#include "unicharset.h"
#include "unicharset_training_utils.h"
STRING_PARAM_FLAG(output_unicharset, "unicharset", "Output file path");
INT_PARAM_FLAG(norm_mode, 1,
"Normalization mode: 1=Combine graphemes, "
"2=Split graphemes, 3=Pure unicode");
static STRING_PARAM_FLAG(output_unicharset, "unicharset", "Output file path");
static INT_PARAM_FLAG(norm_mode, 1,
"Normalization mode: 1=Combine graphemes, "
"2=Split graphemes, 3=Pure unicode");
namespace tesseract {

View File

@ -315,18 +315,6 @@ static std::string ScrollViewCommand(std::string scrollview_path) {
return command;
}
// Platform-independent freeaddrinfo()
static void TessFreeAddrInfo(struct addrinfo* addr_info) {
#if defined(__linux__)
freeaddrinfo(addr_info);
#else
delete addr_info->ai_addr;
delete addr_info;
#endif
}
// Set up a connection to a ScrollView on hostname:port.
SVNetwork::SVNetwork(const char* hostname, int port) {
msg_buffer_in_ = new char[kMaxMsgSize + 1];