提交 6ae6c0a0 编写于 作者: T theraysmith

Made some preliminary changes for improving xheights

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@107 d0cd1f9f-072b-0410-8dd7-cf729c803f20
上级 f382fb56
......@@ -606,7 +606,7 @@ void classify_word_pass1( //recog one word
check_debug_pt (word, 0);
matcher_pass = 0;
bln_word = make_bln_copy (word->word, row, row->x_height (), &word->denorm);
bln_word = make_bln_copy (word->word, row, word->x_height, &word->denorm);
word->best_choice = tess_segment_pass1 (bln_word, &word->denorm,
tess_default_matcher,
......@@ -744,14 +744,15 @@ void classify_word_pass2( //word to do
if (!word->done ||
tessedit_training_tess ||
tessedit_training_wiseowl || tessedit_dump_choices) {
word->x_height = row->x_height ();
word->caps_height = 0.0;
if (word->x_height == 0.0f)
word->x_height = row->x_height();
if (word->outword != NULL) {
delete word->outword; //get rid of junk
delete word->best_choice;
delete word->raw_choice;
}
match_word_pass2 (word, row, row->x_height ());
match_word_pass2 (word, row, word->x_height);
done_this_pass = TRUE;
check_debug_pt (word, 40);
}
......
......@@ -431,6 +431,7 @@ void transform_to_next_perm(WERD_RES_LIST &words) {
//deep copy
combo = new WERD_RES (copy_word);
combo->combination = TRUE;
combo->x_height = prev_word->x_height;
prev_word->part_of_combo = TRUE;
prev_word_it.add_before_then_move (combo);
}
......
......@@ -348,8 +348,10 @@ LIST call_matcher( //call a matcher
char choice_lengths[2] = {0, 0};
blob = make_ed_blob (tessblob);//convert blob
if (blob == NULL)
if (blob == NULL) {
tprintf("Failed to convert blob for recognition!\n");
return NULL; //can't do it
}
pblob = ptblob != NULL ? make_ed_blob (ptblob) : NULL;
nblob = ntblob != NULL ? make_ed_blob (ntblob) : NULL;
(*tess_matcher) (pblob, blob, nblob, tess_word, tess_denorm, ratings);
......
......@@ -104,6 +104,7 @@ ROW_RES::ROW_RES( //recursive construct
for (word_it.mark_cycle_pt (); !word_it.cycled_list (); word_it.forward ()) {
word_res = new WERD_RES (word_it.data ());
word_res->x_height = the_row->x_height();
if (word_res->word->flag (W_FUZZY_NON)) {
ASSERT_HOST (combo != NULL);
......@@ -116,6 +117,7 @@ ROW_RES::ROW_RES( //recursive construct
//deep copy
*copy_word = *(word_it.data ());
combo = new WERD_RES (copy_word);
combo->x_height = the_row->x_height();
combo->combination = TRUE;
word_res_it.add_to_end (combo);
}
......
......@@ -434,6 +434,8 @@ CHOICES_LIST chop_word_main(register TWERD *word,
(CHOICES) classify_blob (pblob, blob, blob->next, NULL, fx,
"chop_word:", Green, &chop_states[0],
&best_state, matcher_pass, index);
if (match_result == NULL)
cprintf("Null classifier output!\n");
char_choices = array_push (char_choices, match_result);
pblob = blob;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册