mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-19 23:19:07 +08:00
commit
d1912d7010
@ -181,7 +181,7 @@ class TESS_API ChoiceIterator {
|
||||
public:
|
||||
// Construction is from a LTRResultIterator that points to the symbol of
|
||||
// interest. The ChoiceIterator allows a one-shot iteration over the
|
||||
// choices for this symbol and after that is is useless.
|
||||
// choices for this symbol and after that it is useless.
|
||||
explicit ChoiceIterator(const LTRResultIterator &result_it);
|
||||
~ChoiceIterator();
|
||||
|
||||
|
@ -225,7 +225,7 @@ bool PageIterator::IsAtFinalElement(PageIteratorLevel level,
|
||||
return true; // Already at the end!
|
||||
}
|
||||
// The result is true if we step forward by element and find we are
|
||||
// at the the end of the page or at beginning of *all* levels in:
|
||||
// at the end of the page or at beginning of *all* levels in:
|
||||
// [level, element).
|
||||
// When there is more than one level difference between element and level,
|
||||
// we could for instance move forward one symbol and still be at the first
|
||||
|
@ -616,7 +616,7 @@ bool ResultIterator::IsAtFinalElement(PageIteratorLevel level, PageIteratorLevel
|
||||
return true; // Already at the end!
|
||||
}
|
||||
// The result is true if we step forward by element and find we are
|
||||
// at the the end of the page or at beginning of *all* levels in:
|
||||
// at the end of the page or at beginning of *all* levels in:
|
||||
// [level, element).
|
||||
// When there is more than one level difference between element and level,
|
||||
// we could for instance move forward one symbol and still be at the first
|
||||
|
@ -769,7 +769,7 @@ public:
|
||||
#ifndef GRAPHICS_DISABLED
|
||||
// Draw the noise blobs from all lists in red.
|
||||
void plot_noise_blobs(ScrollView *to_win);
|
||||
// Draw the blobs on on the various lists in the block in different colors.
|
||||
// Draw the blobs on the various lists in the block in different colors.
|
||||
void plot_graded_blobs(ScrollView *to_win);
|
||||
#endif
|
||||
|
||||
|
@ -871,7 +871,7 @@ void C_OUTLINE::ComputeBinaryOffsets() {
|
||||
increment_step(s, 1, &head_pos, dir_counts, pos_totals);
|
||||
}
|
||||
for (int s = 0; s < stepcount; pos += step(s++)) {
|
||||
// At step s, s in in the middle of [s-2, s+2].
|
||||
// At step s, s in the middle of [s-2, s+2].
|
||||
increment_step(s + 2, 1, &head_pos, dir_counts, pos_totals);
|
||||
int dir_index = chain_code(s);
|
||||
ICOORD step_vec = step(s);
|
||||
|
@ -180,7 +180,7 @@ static void ComputeRunlengthImage(const TBOX &box,
|
||||
++y;
|
||||
}
|
||||
}
|
||||
// Now set the image pixels the the MIN of the x and y runlengths.
|
||||
// Now set the image pixels the MIN of the x and y runlengths.
|
||||
for (int iy = 0; iy < height; ++iy) {
|
||||
int x = 0;
|
||||
for (auto x_coord : x_coords[iy]) {
|
||||
|
@ -347,7 +347,7 @@ void BLOCK_RECT_IT::forward() { // next rectangle
|
||||
/**********************************************************************
|
||||
* BLOCK_LINE_IT::get_line
|
||||
*
|
||||
* Get the the start and width of a line in the block.
|
||||
* Get the start and width of a line in the block.
|
||||
**********************************************************************/
|
||||
|
||||
TDimension BLOCK_LINE_IT::get_line( // get a line
|
||||
|
@ -116,7 +116,7 @@ public:
|
||||
|
||||
// Comparator function for sorting AmbigSpec_LISTs. The lists will
|
||||
// be sorted by their wrong_ngram arrays. Example of wrong_ngram vectors
|
||||
// in a a sorted AmbigSpec_LIST: [9 1 3], [9 3 4], [9 8], [9, 8 1].
|
||||
// in a sorted AmbigSpec_LIST: [9 1 3], [9 3 4], [9 8], [9, 8 1].
|
||||
static int compare_ambig_specs(const void *spec1, const void *spec2) {
|
||||
const AmbigSpec *s1 = *static_cast<const AmbigSpec *const *>(spec1);
|
||||
const AmbigSpec *s2 = *static_cast<const AmbigSpec *const *>(spec2);
|
||||
|
@ -48,7 +48,7 @@ TessdataManager::TessdataManager(FileReader reader)
|
||||
SetVersionString(TESSERACT_VERSION_STR);
|
||||
}
|
||||
|
||||
// Lazily loads from the the given filename. Won't actually read the file
|
||||
// Lazily loads from the given filename. Won't actually read the file
|
||||
// until it needs it.
|
||||
void TessdataManager::LoadFileLater(const char *data_file_name) {
|
||||
Clear();
|
||||
|
@ -138,7 +138,7 @@ public:
|
||||
return is_loaded_;
|
||||
}
|
||||
|
||||
// Lazily loads from the the given filename. Won't actually read the file
|
||||
// Lazily loads from the given filename. Won't actually read the file
|
||||
// until it needs it.
|
||||
void LoadFileLater(const char *data_file_name);
|
||||
/**
|
||||
|
@ -66,7 +66,7 @@ class FCOORD;
|
||||
|
||||
/* The first 3 dimensions of the CLASS_PRUNER_STRUCT are the
|
||||
* 3 axes of the quantized feature space.
|
||||
* The position of the the bits recorded for each class in the
|
||||
* The position of the bits recorded for each class in the
|
||||
* 4th dimension is determined by using CPrunerWordIndexFor(c),
|
||||
* where c is the corresponding class id. */
|
||||
struct CLASS_PRUNER_STRUCT {
|
||||
|
@ -333,7 +333,7 @@ protected:
|
||||
|
||||
// Finds the edge with the given direction, word_end and unichar_id
|
||||
// in the node indicated by node_ref. Fills in the pointer to the
|
||||
// EDGE_RECORD and the index of the edge with the the values
|
||||
// EDGE_RECORD and the index of the edge with the values
|
||||
// corresponding to the edge found. Returns true if an edge was found.
|
||||
bool edge_char_of(NODE_REF node_ref, NODE_REF next_node, int direction, bool word_end,
|
||||
UNICHAR_ID unichar_id, EDGE_RECORD **edge_ptr, EDGE_INDEX *edge_index) const;
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
// 6. Destruction. Use of a single column finder for multiple images does not
|
||||
// make sense.
|
||||
// Throughout these steps, the ColPartitions are owned by part_grid_, which
|
||||
// means that that it must be kept correct. Exception: big_parts_ owns its
|
||||
// means that it must be kept correct. Exception: big_parts_ owns its
|
||||
// own ColPartitions.
|
||||
// The BLOBNBOXes are owned by the input TO_BLOCK for the whole time, except
|
||||
// for a phase in FindBlocks before TransformToBlocks, when they become
|
||||
|
@ -1378,7 +1378,7 @@ bool ColPartition::HasGoodBaseline() {
|
||||
} else {
|
||||
// Horizontal lines use the bottom as the baseline.
|
||||
TBOX box(it.data()->bounding_box());
|
||||
// Use the bottom-left of the first box, the the bottom-right of the last,
|
||||
// Use the bottom-left of the first box, the bottom-right of the last,
|
||||
// and the middle of all others.
|
||||
ICOORD first_pt(box.left(), box.bottom());
|
||||
linepoints.Add(first_pt);
|
||||
@ -1623,7 +1623,7 @@ static TO_BLOCK *MoveBlobsToBlock(bool vertical_text, int line_spacing,
|
||||
ColPartition_LIST *used_parts) {
|
||||
// Make a matching TO_BLOCK and put all the BLOBNBOXes from the parts in it.
|
||||
// Move all the parts to a done list as they are no longer needed, except
|
||||
// that have have to continue to exist until the part grid is deleted.
|
||||
// that have to continue to exist until the part grid is deleted.
|
||||
// Compute the median blob size as we go, as the block needs to know.
|
||||
TBOX block_box(block->pdblk.bounding_box());
|
||||
STATS sizes(0, std::max(block_box.width(), block_box.height()) - 1);
|
||||
@ -1780,7 +1780,7 @@ TO_BLOCK *ColPartition::MakeVerticalTextBlock(const ICOORD &bleft,
|
||||
}
|
||||
|
||||
// Makes a TO_ROW matching this and moves all the blobs to it, transferring
|
||||
// ownership to to returned TO_ROW.
|
||||
// ownership to returned TO_ROW.
|
||||
TO_ROW *ColPartition::MakeToRow() {
|
||||
BLOBNBOX_C_IT blob_it(&boxes_);
|
||||
TO_ROW *row = nullptr;
|
||||
|
@ -671,7 +671,7 @@ public:
|
||||
ColPartition_LIST *used_parts);
|
||||
|
||||
// Makes a TO_ROW matching this and moves all the blobs to it, transferring
|
||||
// ownership to to returned TO_ROW.
|
||||
// ownership to returned TO_ROW.
|
||||
TO_ROW *MakeToRow();
|
||||
|
||||
// Returns a copy of everything except the list of boxes. The resulting
|
||||
|
@ -199,7 +199,7 @@ int ShiroRekhaSplitter::GetXheightForCC(Box *cc_bbox) {
|
||||
int baseline = static_cast<int>(row->base_line(box_middle) + 0.5);
|
||||
TBOX test_box(box_middle - row->x_height() / 2, baseline, box_middle + row->x_height() / 2,
|
||||
static_cast<int>(baseline + row->x_height()));
|
||||
// Compute overlap. If it is is a major overlap, this is the right row.
|
||||
// Compute overlap. If it is a major overlap, this is the right row.
|
||||
if (bbox.major_overlap(test_box)) {
|
||||
return row->x_height();
|
||||
}
|
||||
|
@ -787,7 +787,7 @@ void Textord::improve_row_threshold(TO_ROW *row, STATS *all_gap_stats) {
|
||||
/*
|
||||
Look for the first region of all 0's in the histogram which is wider than
|
||||
max(3, (sp - kn) / 3) and starts between kn and sp. If found, and current
|
||||
threshold is not within it, move the threshold so that is is just inside it.
|
||||
threshold is not within it, move the threshold so that is just inside it.
|
||||
*/
|
||||
reqd_zero_width = static_cast<int16_t>(floor((sp - kn) / 3 + 0.5));
|
||||
if (reqd_zero_width < 3) {
|
||||
|
@ -466,7 +466,7 @@ protected:
|
||||
// significant learning. learning_iteration_ <= training_iteration_.
|
||||
// learning_iteration_ is used to measure rate of learning progress.
|
||||
int learning_iteration_;
|
||||
// Saved value of sample_iteration_ before looking for the the next sample.
|
||||
// Saved value of sample_iteration_ before looking for the next sample.
|
||||
int prev_sample_iteration_;
|
||||
// How often to include a PERFECT training sample in backprop.
|
||||
// A PERFECT training sample is used if the current
|
||||
|
@ -236,7 +236,7 @@ protected:
|
||||
// Constructs WERD_CHOICE by recording unichar_ids of the BLOB_CHOICEs
|
||||
// on the path represented by the given BLOB_CHOICE and language model
|
||||
// state entries (lmse, dse). The path is re-constructed by following
|
||||
// the parent pointers in the the lang model state entries). If the
|
||||
// the parent pointers in the lang model state entries). If the
|
||||
// constructed WERD_CHOICE is better than the best/raw choice recorded
|
||||
// in the best_choice_bundle, this function updates the corresponding
|
||||
// fields and sets best_choice_bunldle->updated to true.
|
||||
@ -367,7 +367,7 @@ protected:
|
||||
// Set to true if a choice representing correct segmentation was explored.
|
||||
bool correct_segmentation_explored_ = false;
|
||||
|
||||
// Params models containing weights for for computing ViterbiStateEntry costs.
|
||||
// Params models containing weights for computing ViterbiStateEntry costs.
|
||||
ParamsModel params_model_;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user