Tesseract  3.02
tesseract-ocr/textord/cjkpitch.cpp File Reference
#include "cjkpitch.h"
#include "genericvector.h"
#include "ndminx.h"
#include "topitch.h"
#include "tovars.h"

Go to the source code of this file.

Functions

void compute_fixed_pitch_cjk (ICOORD page_tr, TO_BLOCK_LIST *port_blocks)

Variables

bool textord_space_size_is_variable = 0

Function Documentation

void compute_fixed_pitch_cjk ( ICOORD  page_tr,
TO_BLOCK_LIST *  port_blocks 
)

Definition at line 1057 of file cjkpitch.cpp.

                                                         {
  FPAnalyzer analyzer;
  analyzer.Init(page_tr, port_blocks);
  if (analyzer.num_rows() == 0) return;

  analyzer.Pass1Analyze();
  analyzer.EstimatePitch(true);

  // Perform pass1 analysis again with the initial estimation of row
  // pitches, for better estimation.
  analyzer.Pass1Analyze();
  analyzer.EstimatePitch(true);

  // Early exit if the page doesn't seem to contain fixed pitch rows.
  if (!analyzer.maybe_fixed_pitch()) {
    if (textord_debug_pitch_test) {
      tprintf("Page doesn't seem to contain fixed pitch rows\n");
    }
    return;
  }

  int iteration = 0;
  do {
    analyzer.MergeFragments();
    analyzer.FinalizeLargeChars();
    analyzer.EstimatePitch(false);
    iteration++;
  } while (analyzer.Pass2Analyze() && iteration < analyzer.max_iteration());

  if (textord_debug_pitch_test) {
    tprintf("compute_fixed_pitch_cjk finished after %d iteration (limit=%d)\n",
            iteration, analyzer.max_iteration());
  }

  analyzer.OutputEstimations();
  if (textord_debug_pitch_test) analyzer.DebugOutputResult();
}

Variable Documentation

"If true, word delimiter spaces are assumed to have " "variable width, even though characters have fixed pitch."

Definition at line 28 of file cjkpitch.cpp.