All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cjkpitch.h File Reference
#include "blobbox.h"

Go to the source code of this file.

Functions

void compute_fixed_pitch_cjk (ICOORD page_tr, TO_BLOCK_LIST *port_blocks)
 

Function Documentation

void compute_fixed_pitch_cjk ( ICOORD  page_tr,
TO_BLOCK_LIST *  port_blocks 
)

Definition at line 1057 of file cjkpitch.cpp.

1058  {
1059  FPAnalyzer analyzer;
1060  analyzer.Init(page_tr, port_blocks);
1061  if (analyzer.num_rows() == 0) return;
1062 
1063  analyzer.Pass1Analyze();
1064  analyzer.EstimatePitch(true);
1065 
1066  // Perform pass1 analysis again with the initial estimation of row
1067  // pitches, for better estimation.
1068  analyzer.Pass1Analyze();
1069  analyzer.EstimatePitch(true);
1070 
1071  // Early exit if the page doesn't seem to contain fixed pitch rows.
1072  if (!analyzer.maybe_fixed_pitch()) {
1074  tprintf("Page doesn't seem to contain fixed pitch rows\n");
1075  }
1076  return;
1077  }
1078 
1079  int iteration = 0;
1080  do {
1081  analyzer.MergeFragments();
1082  analyzer.FinalizeLargeChars();
1083  analyzer.EstimatePitch(false);
1084  iteration++;
1085  } while (analyzer.Pass2Analyze() && iteration < analyzer.max_iteration());
1086 
1088  tprintf("compute_fixed_pitch_cjk finished after %d iteration (limit=%d)\n",
1089  iteration, analyzer.max_iteration());
1090  }
1091 
1092  analyzer.OutputEstimations();
1093  if (textord_debug_pitch_test) analyzer.DebugOutputResult();
1094 }
#define tprintf(...)
Definition: tprintf.h:31
EXTERN bool textord_debug_pitch_test
Definition: topitch.cpp:44