tesseract  4.00.00dev
wordclass.cpp
Go to the documentation of this file.
1 /* -*-C-*-
2  ********************************************************************************
3  *
4  * File: wordclass.c (Formerly wordclass.c)
5  * Description: Word classifier
6  * Author: Mark Seaman, OCR Technology
7  * Created: Tue Jan 30 14:03:25 1990
8  * Modified: Fri Jul 12 16:03:06 1991 (Mark Seaman) marks@hpgrlt
9  * Language: C
10  * Package: N/A
11  * Status: Experimental (Do Not Distribute)
12  *
13  * (c) Copyright 1990, Hewlett-Packard Company.
14  ** Licensed under the Apache License, Version 2.0 (the "License");
15  ** you may not use this file except in compliance with the License.
16  ** You may obtain a copy of the License at
17  ** http://www.apache.org/licenses/LICENSE-2.0
18  ** Unless required by applicable law or agreed to in writing, software
19  ** distributed under the License is distributed on an "AS IS" BASIS,
20  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  ** See the License for the specific language governing permissions and
22  ** limitations under the License.
23  *
24  *********************************************************************************/
25 /*----------------------------------------------------------------------
26  I N C L U D E S
27 ----------------------------------------------------------------------*/
28 #include <assert.h>
29 #include <stdio.h>
30 
31 #include "associate.h"
32 #include "render.h"
33 #include "callcpp.h"
34 #include "wordrec.h"
35 
36 // Include automatically generated configuration file if running autoconf.
37 #ifdef HAVE_CONFIG_H
38 #include "config_auto.h"
39 #endif
40 
41 /*----------------------------------------------------------------------
42  F u n c t i o n s
43 ----------------------------------------------------------------------*/
44 namespace tesseract {
56 BLOB_CHOICE_LIST *Wordrec::classify_blob(TBLOB *blob,
57  const char *string, C_COL color,
58  BlamerBundle *blamer_bundle) {
59 #ifndef GRAPHICS_DISABLED
61  display_blob(blob, color);
62 #endif
63  // TODO(rays) collapse with call_matcher and move all to wordrec.cpp.
64  BLOB_CHOICE_LIST* choices = call_matcher(blob);
65  // If a blob with the same bounding box as one of the truth character
66  // bounding boxes is not classified as the corresponding truth character
67  // blame character classifier for incorrect answer.
68  if (blamer_bundle != NULL) {
69  blamer_bundle->BlameClassifier(getDict().getUnicharset(),
70  blob->bounding_box(),
71  *choices,
73  }
74  #ifndef GRAPHICS_DISABLED
75  if (classify_debug_level && string)
76  print_ratings_list(string, choices, getDict().getUnicharset());
77 
80 #endif
81 
82  return choices;
83 }
84 
85 } // namespace tesseract;
bool wordrec_display_all_blobs
Definition: render.cpp:49
BLOB_CHOICE_LIST * classify_blob(TBLOB *blob, const char *string, C_COL color, BlamerBundle *blamer_bundle)
Definition: wordclass.cpp:56
BLOB_CHOICE_LIST * call_matcher(TBLOB *blob)
Definition: tface.cpp:138
void BlameClassifier(const UNICHARSET &unicharset, const TBOX &blob_box, const BLOB_CHOICE_LIST &choices, bool debug)
Definition: blamer.cpp:257
Dict & getDict()
Definition: classify.h:65
C_COL
Definition: callcpp.h:32
void display_blob(TBLOB *blob, C_COL color)
Definition: render.cpp:64
bool wordrec_blob_pause
Definition: render.cpp:53
char window_wait(ScrollView *win)
Definition: callcpp.cpp:111
Definition: blobs.h:261
void print_ratings_list(const char *msg, BLOB_CHOICE_LIST *ratings, const UNICHARSET &current_unicharset)
Definition: ratngs.cpp:819
bool wordrec_debug_blamer
Definition: wordrec.h:167
TBOX bounding_box() const
Definition: blobs.cpp:482
ScrollView * blob_window
Definition: render.cpp:43