tesseract  4.0.0-1-g2a2b
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

◆ compute_fixed_pitch_cjk()

void compute_fixed_pitch_cjk ( ICOORD  page_tr,
TO_BLOCK_LIST *  port_blocks 
)

Definition at line 1060 of file cjkpitch.cpp.

1061  {
1062  FPAnalyzer analyzer(page_tr, port_blocks);
1063  if (analyzer.num_rows() == 0) return;
1064 
1065  analyzer.Pass1Analyze();
1066  analyzer.EstimatePitch(true);
1067 
1068  // Perform pass1 analysis again with the initial estimation of row
1069  // pitches, for better estimation.
1070  analyzer.Pass1Analyze();
1071  analyzer.EstimatePitch(true);
1072 
1073  // Early exit if the page doesn't seem to contain fixed pitch rows.
1074  if (!analyzer.maybe_fixed_pitch()) {
1076  tprintf("Page doesn't seem to contain fixed pitch rows\n");
1077  }
1078  return;
1079  }
1080 
1081  unsigned iteration = 0;
1082  do {
1083  analyzer.MergeFragments();
1084  analyzer.FinalizeLargeChars();
1085  analyzer.EstimatePitch(false);
1086  iteration++;
1087  } while (analyzer.Pass2Analyze() && iteration < analyzer.max_iteration());
1088 
1090  tprintf("compute_fixed_pitch_cjk finished after %u iteration (limit=%u)\n",
1091  iteration, analyzer.max_iteration());
1092  }
1093 
1094  analyzer.OutputEstimations();
1095  if (textord_debug_pitch_test) analyzer.DebugOutputResult();
1096 }
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:37
EXTERN bool textord_debug_pitch_test
Definition: topitch.cpp:42