2007-03-08 04:03:40 +08:00
|
|
|
/**********************************************************************
|
|
|
|
* File: topitch.h (Formerly to_pitch.h)
|
|
|
|
* Description: Code to determine fixed pitchness and the pitch if fixed.
|
|
|
|
* Author: Ray Smith
|
|
|
|
* Created: Tue Aug 24 16:57:29 BST 1993
|
|
|
|
*
|
|
|
|
* (C) Copyright 1993, Hewlett-Packard Ltd.
|
|
|
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
** you may not use this file except in compliance with the License.
|
|
|
|
** You may obtain a copy of the License at
|
|
|
|
** http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
** Unless required by applicable law or agreed to in writing, software
|
|
|
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
** See the License for the specific language governing permissions and
|
|
|
|
** limitations under the License.
|
|
|
|
*
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#ifndef TOPITCH_H
|
|
|
|
#define TOPITCH_H
|
|
|
|
|
|
|
|
#include "blobbox.h"
|
|
|
|
|
2009-07-11 10:39:56 +08:00
|
|
|
namespace tesseract {
|
|
|
|
class Tesseract;
|
|
|
|
}
|
2007-03-08 04:03:40 +08:00
|
|
|
extern BOOL_VAR_H (textord_debug_pitch_test, FALSE,
|
|
|
|
"Debug on fixed pitch test");
|
|
|
|
extern BOOL_VAR_H (textord_debug_pitch_metric, FALSE,
|
|
|
|
"Write full metric stuff");
|
|
|
|
extern BOOL_VAR_H (textord_show_row_cuts, FALSE, "Draw row-level cuts");
|
|
|
|
extern BOOL_VAR_H (textord_show_page_cuts, FALSE, "Draw page-level cuts");
|
|
|
|
extern BOOL_VAR_H (textord_pitch_cheat, FALSE,
|
|
|
|
"Use correct answer for fixed/prop");
|
|
|
|
extern BOOL_VAR_H (textord_blockndoc_fixed, TRUE,
|
|
|
|
"Attempt whole doc/block fixed pitch");
|
|
|
|
extern BOOL_VAR_H (textord_fast_pitch_test, FALSE,
|
|
|
|
"Do even faster pitch algorithm");
|
|
|
|
extern double_VAR_H (textord_projection_scale, 0.125,
|
|
|
|
"Ding rate for mid-cuts");
|
|
|
|
extern double_VAR_H (textord_balance_factor, 2.0,
|
|
|
|
"Ding rate for unbalanced char cells");
|
2009-07-11 10:39:56 +08:00
|
|
|
|
2010-11-24 02:34:14 +08:00
|
|
|
void compute_fixed_pitch(ICOORD page_tr, // top right
|
2018-05-21 03:46:46 +08:00
|
|
|
TO_BLOCK_LIST* port_blocks, // input list
|
2010-11-24 02:34:14 +08:00
|
|
|
float gradient, // page skew
|
|
|
|
FCOORD rotation, // for drawing
|
2018-05-21 03:46:46 +08:00
|
|
|
bool testing_on); // correct orientation
|
2007-03-08 04:03:40 +08:00
|
|
|
void fix_row_pitch( //get some value
|
|
|
|
TO_ROW *bad_row, //row to fix
|
|
|
|
TO_BLOCK *bad_block, //block of bad_row
|
|
|
|
TO_BLOCK_LIST *blocks, //blocks to scan
|
Use POSIX data types and macros (#878)
* api: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* cutil: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* training: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract data types by POSIX data types
Now all Tesseract data types which are no longer needed can be removed
from ccutil/host.h.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* lstm: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Remove the macros which are now unused from ccutil/host.h.
Remove also the obsolete history comments.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Fix build error caused by ambiguous ClipToRange
Error message vom Appveyor CI:
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2672: 'ClipToRange': no matching overloaded function found [C:\projects\tesseract\build\libtesseract.vcxproj]
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2782: 'T ClipToRange(const T &,const T &,const T &)': template parameter 'T' is ambiguous [C:\projects\tesseract\build\libtesseract.vcxproj]
c:\projects\tesseract\ccutil\helpers.h(122): note: see declaration of 'ClipToRange'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: could be 'char'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: or 'int'
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* unittest: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* arch: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-03-14 04:36:30 +08:00
|
|
|
int32_t row_target, //number of row
|
|
|
|
int32_t block_target //number of block
|
2007-03-08 04:03:40 +08:00
|
|
|
);
|
2018-05-21 03:46:46 +08:00
|
|
|
void compute_block_pitch(TO_BLOCK* block, // input list
|
2010-11-24 02:34:14 +08:00
|
|
|
FCOORD rotation, // for drawing
|
Use POSIX data types and macros (#878)
* api: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* cutil: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* training: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract data types by POSIX data types
Now all Tesseract data types which are no longer needed can be removed
from ccutil/host.h.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* lstm: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Remove the macros which are now unused from ccutil/host.h.
Remove also the obsolete history comments.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Fix build error caused by ambiguous ClipToRange
Error message vom Appveyor CI:
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2672: 'ClipToRange': no matching overloaded function found [C:\projects\tesseract\build\libtesseract.vcxproj]
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2782: 'T ClipToRange(const T &,const T &,const T &)': template parameter 'T' is ambiguous [C:\projects\tesseract\build\libtesseract.vcxproj]
c:\projects\tesseract\ccutil\helpers.h(122): note: see declaration of 'ClipToRange'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: could be 'char'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: or 'int'
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* unittest: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* arch: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-03-14 04:36:30 +08:00
|
|
|
int32_t block_index, // block number
|
2018-05-21 03:46:46 +08:00
|
|
|
bool testing_on); // correct orientation
|
|
|
|
bool compute_rows_pitch( //find line stats
|
|
|
|
TO_BLOCK* block, //block to do
|
|
|
|
int32_t block_index, //block number
|
|
|
|
bool testing_on //correct orientation
|
|
|
|
);
|
|
|
|
bool try_doc_fixed( //determine pitch
|
|
|
|
ICOORD page_tr, //top right
|
|
|
|
TO_BLOCK_LIST* port_blocks, //input list
|
|
|
|
float gradient //page skew
|
|
|
|
);
|
|
|
|
bool try_block_fixed( //find line stats
|
|
|
|
TO_BLOCK* block, //block to do
|
|
|
|
int32_t block_index //block number
|
|
|
|
);
|
|
|
|
bool try_rows_fixed( //find line stats
|
|
|
|
TO_BLOCK* block, //block to do
|
|
|
|
int32_t block_index, //block number
|
|
|
|
bool testing_on //correct orientation
|
|
|
|
);
|
2007-03-08 04:03:40 +08:00
|
|
|
void print_block_counts( //find line stats
|
|
|
|
TO_BLOCK *block, //block to do
|
Use POSIX data types and macros (#878)
* api: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* cutil: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* training: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract data types by POSIX data types
Now all Tesseract data types which are no longer needed can be removed
from ccutil/host.h.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* lstm: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Remove the macros which are now unused from ccutil/host.h.
Remove also the obsolete history comments.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Fix build error caused by ambiguous ClipToRange
Error message vom Appveyor CI:
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2672: 'ClipToRange': no matching overloaded function found [C:\projects\tesseract\build\libtesseract.vcxproj]
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2782: 'T ClipToRange(const T &,const T &,const T &)': template parameter 'T' is ambiguous [C:\projects\tesseract\build\libtesseract.vcxproj]
c:\projects\tesseract\ccutil\helpers.h(122): note: see declaration of 'ClipToRange'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: could be 'char'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: or 'int'
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* unittest: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* arch: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-03-14 04:36:30 +08:00
|
|
|
int32_t block_index //block number
|
2007-03-08 04:03:40 +08:00
|
|
|
);
|
|
|
|
void count_block_votes( //find line stats
|
|
|
|
TO_BLOCK *block, //block to do
|
Use POSIX data types and macros (#878)
* api: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* cutil: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* training: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract data types by POSIX data types
Now all Tesseract data types which are no longer needed can be removed
from ccutil/host.h.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* lstm: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Remove the macros which are now unused from ccutil/host.h.
Remove also the obsolete history comments.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Fix build error caused by ambiguous ClipToRange
Error message vom Appveyor CI:
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2672: 'ClipToRange': no matching overloaded function found [C:\projects\tesseract\build\libtesseract.vcxproj]
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2782: 'T ClipToRange(const T &,const T &,const T &)': template parameter 'T' is ambiguous [C:\projects\tesseract\build\libtesseract.vcxproj]
c:\projects\tesseract\ccutil\helpers.h(122): note: see declaration of 'ClipToRange'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: could be 'char'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: or 'int'
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* unittest: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* arch: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-03-14 04:36:30 +08:00
|
|
|
int32_t &def_fixed, //add to counts
|
|
|
|
int32_t &def_prop,
|
|
|
|
int32_t &maybe_fixed,
|
|
|
|
int32_t &maybe_prop,
|
|
|
|
int32_t &corr_fixed,
|
|
|
|
int32_t &corr_prop,
|
|
|
|
int32_t &dunno);
|
2018-05-21 03:46:46 +08:00
|
|
|
bool row_pitch_stats( //find line stats
|
|
|
|
TO_ROW* row, //current row
|
|
|
|
int32_t maxwidth, //of spaces
|
|
|
|
bool testing_on //correct orientation
|
|
|
|
);
|
|
|
|
bool find_row_pitch( //find lines
|
|
|
|
TO_ROW* row, //row to do
|
|
|
|
int32_t maxwidth, //max permitted space
|
|
|
|
int32_t dm_gap, //ignorable gaps
|
|
|
|
TO_BLOCK* block, //block of row
|
|
|
|
int32_t block_index, //block_number
|
|
|
|
int32_t row_index, //number of row
|
|
|
|
bool testing_on //correct orientation
|
|
|
|
);
|
|
|
|
bool fixed_pitch_row( //find lines
|
|
|
|
TO_ROW* row, //row to do
|
|
|
|
BLOCK* block,
|
|
|
|
int32_t block_index //block_number
|
|
|
|
);
|
|
|
|
bool count_pitch_stats( //find lines
|
|
|
|
TO_ROW* row, //row to do
|
|
|
|
STATS* gap_stats, //blob gaps
|
|
|
|
STATS* pitch_stats, //centre-centre stats
|
|
|
|
float initial_pitch, //guess at pitch
|
|
|
|
float min_space, //estimate space size
|
|
|
|
bool ignore_outsize, //discard big objects
|
|
|
|
bool split_outsize, //split big objects
|
|
|
|
int32_t dm_gap //ignorable gaps
|
|
|
|
);
|
2007-03-08 04:03:40 +08:00
|
|
|
float tune_row_pitch( //find fp cells
|
2018-05-21 03:46:46 +08:00
|
|
|
TO_ROW* row, //row to do
|
|
|
|
STATS* projection, //vertical projection
|
|
|
|
int16_t projection_left, //edge of projection
|
|
|
|
int16_t projection_right, //edge of projection
|
|
|
|
float space_size, //size of blank
|
|
|
|
float& initial_pitch, //guess at pitch
|
|
|
|
float& best_sp_sd, //space sd
|
|
|
|
int16_t& best_mid_cuts, //no of cheap cuts
|
|
|
|
ICOORDELT_LIST* best_cells, //row cells
|
|
|
|
bool testing_on //inidividual words
|
|
|
|
);
|
2007-03-08 04:03:40 +08:00
|
|
|
float tune_row_pitch2( //find fp cells
|
2018-05-21 03:46:46 +08:00
|
|
|
TO_ROW* row, //row to do
|
|
|
|
STATS* projection, //vertical projection
|
|
|
|
int16_t projection_left, //edge of projection
|
|
|
|
int16_t projection_right, //edge of projection
|
|
|
|
float space_size, //size of blank
|
|
|
|
float& initial_pitch, //guess at pitch
|
|
|
|
float& best_sp_sd, //space sd
|
|
|
|
int16_t& best_mid_cuts, //no of cheap cuts
|
|
|
|
ICOORDELT_LIST* best_cells, //row cells
|
|
|
|
bool testing_on //inidividual words
|
|
|
|
);
|
|
|
|
float compute_pitch_sd( //find fp cells
|
|
|
|
TO_ROW* row, //row to do
|
|
|
|
STATS* projection, //vertical projection
|
|
|
|
int16_t projection_left, //edge
|
|
|
|
int16_t projection_right, //edge
|
|
|
|
float space_size, //size of blank
|
|
|
|
float initial_pitch, //guess at pitch
|
|
|
|
float& sp_sd, //space sd
|
|
|
|
int16_t& mid_cuts, //no of free cuts
|
|
|
|
ICOORDELT_LIST* row_cells, //list of chop pts
|
|
|
|
bool testing_on, //inidividual words
|
|
|
|
int16_t start = 0, //start of good range
|
|
|
|
int16_t end = 0 //end of good range
|
2007-03-08 04:03:40 +08:00
|
|
|
);
|
2018-05-21 03:46:46 +08:00
|
|
|
float compute_pitch_sd2( //find fp cells
|
|
|
|
TO_ROW* row, //row to do
|
|
|
|
STATS* projection, //vertical projection
|
|
|
|
int16_t projection_left, //edge
|
|
|
|
int16_t projection_right, //edge
|
|
|
|
float initial_pitch, //guess at pitch
|
|
|
|
int16_t& occupation, //no of occupied cells
|
|
|
|
int16_t& mid_cuts, //no of free cuts
|
|
|
|
ICOORDELT_LIST* row_cells, //list of chop pts
|
|
|
|
bool testing_on, //inidividual words
|
|
|
|
int16_t start = 0, //start of good range
|
|
|
|
int16_t end = 0 //end of good range
|
2007-03-08 04:03:40 +08:00
|
|
|
);
|
|
|
|
void print_pitch_sd( //find fp cells
|
|
|
|
TO_ROW *row, //row to do
|
|
|
|
STATS *projection, //vertical projection
|
Use POSIX data types and macros (#878)
* api: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* cutil: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* training: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract data types by POSIX data types
Now all Tesseract data types which are no longer needed can be removed
from ccutil/host.h.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* lstm: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Remove the macros which are now unused from ccutil/host.h.
Remove also the obsolete history comments.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Fix build error caused by ambiguous ClipToRange
Error message vom Appveyor CI:
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2672: 'ClipToRange': no matching overloaded function found [C:\projects\tesseract\build\libtesseract.vcxproj]
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2782: 'T ClipToRange(const T &,const T &,const T &)': template parameter 'T' is ambiguous [C:\projects\tesseract\build\libtesseract.vcxproj]
c:\projects\tesseract\ccutil\helpers.h(122): note: see declaration of 'ClipToRange'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: could be 'char'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: or 'int'
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* unittest: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* arch: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-03-14 04:36:30 +08:00
|
|
|
int16_t projection_left, //edges //size of blank
|
|
|
|
int16_t projection_right,
|
2007-03-08 04:03:40 +08:00
|
|
|
float space_size,
|
|
|
|
float initial_pitch //guess at pitch
|
|
|
|
);
|
2018-05-21 03:46:46 +08:00
|
|
|
void find_repeated_chars(TO_BLOCK* block, // Block to search.
|
|
|
|
bool testing_on); // Debug mode.
|
2007-03-08 04:03:40 +08:00
|
|
|
void plot_fp_word( //draw block of words
|
|
|
|
TO_BLOCK *block, //block to draw
|
|
|
|
float pitch, //pitch to draw with
|
|
|
|
float nonspace //for space threshold
|
|
|
|
);
|
|
|
|
#endif
|