tesseract  4.1.0
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 1041 of file cjkpitch.cpp.

1042  {
1043  FPAnalyzer analyzer(page_tr, port_blocks);
1044  if (analyzer.num_rows() == 0) return;
1045 
1046  analyzer.Pass1Analyze();
1047  analyzer.EstimatePitch(true);
1048 
1049  // Perform pass1 analysis again with the initial estimation of row
1050  // pitches, for better estimation.
1051  analyzer.Pass1Analyze();
1052  analyzer.EstimatePitch(true);
1053 
1054  // Early exit if the page doesn't seem to contain fixed pitch rows.
1055  if (!analyzer.maybe_fixed_pitch()) {
1057  tprintf("Page doesn't seem to contain fixed pitch rows\n");
1058  }
1059  return;
1060  }
1061 
1062  unsigned iteration = 0;
1063  do {
1064  analyzer.MergeFragments();
1065  analyzer.FinalizeLargeChars();
1066  analyzer.EstimatePitch(false);
1067  iteration++;
1068  } while (analyzer.Pass2Analyze() && iteration < analyzer.max_iteration());
1069 
1071  tprintf("compute_fixed_pitch_cjk finished after %u iteration (limit=%u)\n",
1072  iteration, analyzer.max_iteration());
1073  }
1074 
1075  analyzer.OutputEstimations();
1076  if (textord_debug_pitch_test) analyzer.DebugOutputResult();
1077 }
bool textord_debug_pitch_test
Definition: topitch.cpp:39
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:36