mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-04 18:29:06 +08:00
commit
e731324a08
@ -188,7 +188,7 @@ int Tesseract::SegmentPage(const STRING* input_file, BLOCK_LIST* blocks,
|
|||||||
* of non-uniform linespacing.
|
* of non-uniform linespacing.
|
||||||
*
|
*
|
||||||
* If diacritic_blobs is non-null, then diacritics/noise blobs, that would
|
* If diacritic_blobs is non-null, then diacritics/noise blobs, that would
|
||||||
* confuse layout anaylsis by causing textline overlap, are placed there,
|
* confuse layout analysis by causing textline overlap, are placed there,
|
||||||
* with the expectation that they will be reassigned to words later and
|
* with the expectation that they will be reassigned to words later and
|
||||||
* noise/diacriticness determined via classification.
|
* noise/diacriticness determined via classification.
|
||||||
*
|
*
|
||||||
|
@ -55,7 +55,7 @@ MasterTrainer::MasterTrainer(NormalizationMode norm_mode,
|
|||||||
: norm_mode_(norm_mode), samples_(fontinfo_table_),
|
: norm_mode_(norm_mode), samples_(fontinfo_table_),
|
||||||
junk_samples_(fontinfo_table_), verify_samples_(fontinfo_table_),
|
junk_samples_(fontinfo_table_), verify_samples_(fontinfo_table_),
|
||||||
charsetsize_(0),
|
charsetsize_(0),
|
||||||
enable_shape_anaylsis_(shape_analysis),
|
enable_shape_analysis_(shape_analysis),
|
||||||
enable_replication_(replicate_samples),
|
enable_replication_(replicate_samples),
|
||||||
fragments_(nullptr), prev_unichar_id_(-1), debug_level_(debug_level) {
|
fragments_(nullptr), prev_unichar_id_(-1), debug_level_(debug_level) {
|
||||||
}
|
}
|
||||||
@ -205,13 +205,13 @@ void MasterTrainer::LoadPageImages(const char* filename) {
|
|||||||
|
|
||||||
// Cleans up the samples after initial load from the tr files, and prior to
|
// Cleans up the samples after initial load from the tr files, and prior to
|
||||||
// saving the MasterTrainer:
|
// saving the MasterTrainer:
|
||||||
// Remaps fragmented chars if running shape anaylsis.
|
// Remaps fragmented chars if running shape analysis.
|
||||||
// Sets up the samples appropriately for class/fontwise access.
|
// Sets up the samples appropriately for class/fontwise access.
|
||||||
// Deletes outlier samples.
|
// Deletes outlier samples.
|
||||||
void MasterTrainer::PostLoadCleanup() {
|
void MasterTrainer::PostLoadCleanup() {
|
||||||
if (debug_level_ > 0)
|
if (debug_level_ > 0)
|
||||||
tprintf("PostLoadCleanup...\n");
|
tprintf("PostLoadCleanup...\n");
|
||||||
if (enable_shape_anaylsis_)
|
if (enable_shape_analysis_)
|
||||||
ReplaceFragmentedSamples();
|
ReplaceFragmentedSamples();
|
||||||
SampleIterator sample_it;
|
SampleIterator sample_it;
|
||||||
sample_it.Init(nullptr, nullptr, true, &verify_samples_);
|
sample_it.Init(nullptr, nullptr, true, &verify_samples_);
|
||||||
|
@ -103,7 +103,7 @@ class MasterTrainer {
|
|||||||
|
|
||||||
// Cleans up the samples after initial load from the tr files, and prior to
|
// Cleans up the samples after initial load from the tr files, and prior to
|
||||||
// saving the MasterTrainer:
|
// saving the MasterTrainer:
|
||||||
// Remaps fragmented chars if running shape anaylsis.
|
// Remaps fragmented chars if running shape analysis.
|
||||||
// Sets up the samples appropriately for class/fontwise access.
|
// Sets up the samples appropriately for class/fontwise access.
|
||||||
// Deletes outlier samples.
|
// Deletes outlier samples.
|
||||||
void PostLoadCleanup();
|
void PostLoadCleanup();
|
||||||
@ -284,7 +284,7 @@ class MasterTrainer {
|
|||||||
int charsetsize_;
|
int charsetsize_;
|
||||||
// Flag to indicate that we are running shape analysis and need fragments
|
// Flag to indicate that we are running shape analysis and need fragments
|
||||||
// fixing.
|
// fixing.
|
||||||
bool enable_shape_anaylsis_;
|
bool enable_shape_analysis_;
|
||||||
// Flag to indicate that sample replication is required.
|
// Flag to indicate that sample replication is required.
|
||||||
bool enable_replication_;
|
bool enable_replication_;
|
||||||
// Array of classids of fragments that replace the correctly segmented chars.
|
// Array of classids of fragments that replace the correctly segmented chars.
|
||||||
|
@ -278,7 +278,7 @@ void ColumnFinder::CorrectOrientation(TO_BLOCK* block,
|
|||||||
// can be an integer factor reduction of the grey_pix. It represents the
|
// can be an integer factor reduction of the grey_pix. It represents the
|
||||||
// thresholds that were used to create the binary_pix from the grey_pix.
|
// thresholds that were used to create the binary_pix from the grey_pix.
|
||||||
// If diacritic_blobs is non-null, then diacritics/noise blobs, that would
|
// If diacritic_blobs is non-null, then diacritics/noise blobs, that would
|
||||||
// confuse layout anaylsis by causing textline overlap, are placed there,
|
// confuse layout analysis by causing textline overlap, are placed there,
|
||||||
// with the expectation that they will be reassigned to words later and
|
// with the expectation that they will be reassigned to words later and
|
||||||
// noise/diacriticness determined via classification.
|
// noise/diacriticness determined via classification.
|
||||||
// Returns -1 if the user hits the 'd' key in the blocks window while running
|
// Returns -1 if the user hits the 'd' key in the blocks window while running
|
||||||
|
@ -72,7 +72,7 @@ TabFind::TabFind(int gridsize, const ICOORD& bleft, const ICOORD& tright,
|
|||||||
v_it_(&vectors_) {
|
v_it_(&vectors_) {
|
||||||
width_cb_ = nullptr;
|
width_cb_ = nullptr;
|
||||||
v_it_.add_list_after(vlines);
|
v_it_.add_list_after(vlines);
|
||||||
SetVerticalSkewAndParellelize(vertical_x, vertical_y);
|
SetVerticalSkewAndParallelize(vertical_x, vertical_y);
|
||||||
width_cb_ = NewPermanentTessCallback(this, &TabFind::CommonWidth);
|
width_cb_ = NewPermanentTessCallback(this, &TabFind::CommonWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -853,7 +853,7 @@ void TabFind::FindAllTabVectors(int min_gutter_width) {
|
|||||||
TabVector_IT v_it(&vectors_);
|
TabVector_IT v_it(&vectors_);
|
||||||
v_it.add_list_after(&dummy_vectors);
|
v_it.add_list_after(&dummy_vectors);
|
||||||
// Now use the summed (mean) vertical vector as the direction for everything.
|
// Now use the summed (mean) vertical vector as the direction for everything.
|
||||||
SetVerticalSkewAndParellelize(vertical_x, vertical_y);
|
SetVerticalSkewAndParallelize(vertical_x, vertical_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper for FindAllTabVectors finds the vectors of a particular type.
|
// Helper for FindAllTabVectors finds the vectors of a particular type.
|
||||||
@ -905,7 +905,7 @@ TabVector* TabFind::FindTabVector(int search_size_multiple,
|
|||||||
|
|
||||||
// Set the vertical_skew_ member from the given vector and refit
|
// Set the vertical_skew_ member from the given vector and refit
|
||||||
// all vectors parallel to the skew vector.
|
// all vectors parallel to the skew vector.
|
||||||
void TabFind::SetVerticalSkewAndParellelize(int vertical_x, int vertical_y) {
|
void TabFind::SetVerticalSkewAndParallelize(int vertical_x, int vertical_y) {
|
||||||
// Fit the vertical vector into an ICOORD, which is 16 bit.
|
// Fit the vertical vector into an ICOORD, which is 16 bit.
|
||||||
vertical_skew_.set_with_shrink(vertical_x, vertical_y);
|
vertical_skew_.set_with_shrink(vertical_x, vertical_y);
|
||||||
if (textord_debug_tabfind)
|
if (textord_debug_tabfind)
|
||||||
@ -1285,7 +1285,7 @@ bool TabFind::Deskew(TabVector_LIST* hlines, BLOBNBOX_LIST* image_blobs,
|
|||||||
TabVector* d = d_it.data();
|
TabVector* d = d_it.data();
|
||||||
d->Rotate(*deskew);
|
d->Rotate(*deskew);
|
||||||
}
|
}
|
||||||
SetVerticalSkewAndParellelize(0, 1);
|
SetVerticalSkewAndParallelize(0, 1);
|
||||||
// Rebuild the grid to the new size.
|
// Rebuild the grid to the new size.
|
||||||
TBOX grid_box(bleft_, tright_);
|
TBOX grid_box(bleft_, tright_);
|
||||||
grid_box.rotate_large(*deskew);
|
grid_box.rotate_large(*deskew);
|
||||||
|
@ -287,7 +287,7 @@ class TabFind : public AlignedBlob {
|
|||||||
|
|
||||||
// Set the vertical_skew_ member from the given vector and refit
|
// Set the vertical_skew_ member from the given vector and refit
|
||||||
// all vectors parallel to the skew vector.
|
// all vectors parallel to the skew vector.
|
||||||
void SetVerticalSkewAndParellelize(int vertical_x, int vertical_y);
|
void SetVerticalSkewAndParallelize(int vertical_x, int vertical_y);
|
||||||
|
|
||||||
// Sort all the current vectors using the vertical_skew_ vector.
|
// Sort all the current vectors using the vertical_skew_ vector.
|
||||||
void SortVectors();
|
void SortVectors();
|
||||||
|
Loading…
Reference in New Issue
Block a user