mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 06:30:14 +08:00
print error/warning messages to stderr/debug file instead of stdout (fix issue 911)
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@843 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
parent
642e9e7615
commit
7e14ade10d
@ -130,7 +130,7 @@ int OSResults::get_best_script(int orientation_id) const {
|
||||
// Print the script scores for all possible orientations.
|
||||
void OSResults::print_scores(void) const {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
printf("Orientation id #%d", i);
|
||||
tprintf("Orientation id #%d", i);
|
||||
print_scores(i);
|
||||
}
|
||||
}
|
||||
@ -139,7 +139,7 @@ void OSResults::print_scores(void) const {
|
||||
void OSResults::print_scores(int orientation_id) const {
|
||||
for (int j = 0; j < kMaxNumberOfScripts; ++j) {
|
||||
if (scripts_na[orientation_id][j]) {
|
||||
printf("%12s\t: %f\n", unicharset->get_script_from_script_id(j),
|
||||
tprintf("%12s\t: %f\n", unicharset->get_script_from_script_id(j),
|
||||
scripts_na[orientation_id][j]);
|
||||
}
|
||||
}
|
||||
@ -284,13 +284,13 @@ int os_detect_blobs(BLOBNBOX_CLIST* blob_list, OSResults* osr,
|
||||
|
||||
BLOBNBOX_C_IT filtered_it(blob_list);
|
||||
int real_max = MIN(filtered_it.length(), kMaxCharactersToTry);
|
||||
// printf("Total blobs found = %d\n", blobs_total);
|
||||
// printf("Number of blobs post-filtering = %d\n", filtered_it.length());
|
||||
// printf("Number of blobs to try = %d\n", real_max);
|
||||
// tprintf("Total blobs found = %d\n", blobs_total);
|
||||
// tprintf("Number of blobs post-filtering = %d\n", filtered_it.length());
|
||||
// tprintf("Number of blobs to try = %d\n", real_max);
|
||||
|
||||
// If there are too few characters, skip this page entirely.
|
||||
if (real_max < kMinCharactersToTry / 2) {
|
||||
printf("Too few characters. Skipping this page\n");
|
||||
tprintf("Too few characters. Skipping this page\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -710,7 +710,7 @@ class TO_BLOCK:public ELIST_LINK
|
||||
for (row_it.mark_cycle_pt (); !row_it.cycled_list ();
|
||||
row_it.forward ()) {
|
||||
row = row_it.data ();
|
||||
printf ("Row range (%g,%g), para_c=%g, blobcount=" INT32FORMAT
|
||||
tprintf ("Row range (%g,%g), para_c=%g, blobcount=" INT32FORMAT
|
||||
"\n", row->min_y (), row->max_y (), row->parallel_c (),
|
||||
row->blob_list ()->length ());
|
||||
}
|
||||
|
@ -172,12 +172,12 @@ C_OUTLINE::C_OUTLINE( //constructor
|
||||
pos += srcline->step (stepindex);
|
||||
destpos = pos;
|
||||
destpos.rotate (rotation);
|
||||
// printf("%i %i %i %i ", destpos.x(), destpos.y(), pos.x(), pos.y());
|
||||
// tprintf("%i %i %i %i ", destpos.x(), destpos.y(), pos.x(), pos.y());
|
||||
while (destpos.x () != prevpos.x () || destpos.y () != prevpos.y ()) {
|
||||
dir = DIR128 (FCOORD (destpos - prevpos));
|
||||
dir += 64; //turn to step style
|
||||
new_step = dir.get_dir ();
|
||||
// printf(" %i\n", new_step);
|
||||
// tprintf(" %i\n", new_step);
|
||||
if (new_step & 31) {
|
||||
set_step(destindex++, dir + round1);
|
||||
prevpos += step(destindex - 1);
|
||||
|
@ -217,7 +217,7 @@ bool TessdataManager::TessdataTypeFromFileSuffix(
|
||||
return true;
|
||||
}
|
||||
}
|
||||
printf("TessdataManager can't determine which tessdata"
|
||||
tprintf("TessdataManager can't determine which tessdata"
|
||||
" component is represented by %s\n", suffix);
|
||||
return false;
|
||||
}
|
||||
@ -239,7 +239,7 @@ bool TessdataManager::ExtractToFile(const char *filename) {
|
||||
|
||||
FILE *output_file = fopen(filename, "wb");
|
||||
if (output_file == NULL) {
|
||||
printf("Error openning %s\n", filename);
|
||||
tprintf("Error openning %s\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
inT64 begin_offset = ftell(GetDataFilePtr());
|
||||
|
@ -179,7 +179,7 @@ SearchNode *SearchColumn::AddNode(LangModEdge *edge, int reco_cost,
|
||||
// because the langmod state is not unique
|
||||
if (edge->IsOOD() == false) {
|
||||
if (!node_hash_table_->Insert(edge, new_node)) {
|
||||
printf("Hash table full!!!");
|
||||
tprintf("Hash table full!!!");
|
||||
delete new_node;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -346,12 +346,12 @@ float Textord::filter_noise_blobs(
|
||||
size_stats.add (height, 1);
|
||||
}
|
||||
max_height = size_stats.ile (textord_initialasc_ile);
|
||||
// printf("max_y=%g, min_y=%g, initial_x=%g, max_height=%g,",
|
||||
// tprintf("max_y=%g, min_y=%g, initial_x=%g, max_height=%g,",
|
||||
// max_y,min_y,initial_x,max_height);
|
||||
max_height *= tesseract::CCStruct::kXHeightCapRatio;
|
||||
if (max_height > initial_x)
|
||||
initial_x = max_height;
|
||||
// printf(" ret=%g\n",initial_x);
|
||||
// tprintf(" ret=%g\n",initial_x);
|
||||
return initial_x;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user