tesseract  3.03
/usr/local/google/home/jbreiden/tesseract-ocr-read-only/wordrec/wordclass.cpp
Go to the documentation of this file.
00001 /* -*-C-*-
00002  ********************************************************************************
00003  *
00004  * File:        wordclass.c  (Formerly wordclass.c)
00005  * Description:  Word classifier
00006  * Author:       Mark Seaman, OCR Technology
00007  * Created:      Tue Jan 30 14:03:25 1990
00008  * Modified:     Fri Jul 12 16:03:06 1991 (Mark Seaman) marks@hpgrlt
00009  * Language:     C
00010  * Package:      N/A
00011  * Status:       Experimental (Do Not Distribute)
00012  *
00013  * (c) Copyright 1990, Hewlett-Packard Company.
00014  ** Licensed under the Apache License, Version 2.0 (the "License");
00015  ** you may not use this file except in compliance with the License.
00016  ** You may obtain a copy of the License at
00017  ** http://www.apache.org/licenses/LICENSE-2.0
00018  ** Unless required by applicable law or agreed to in writing, software
00019  ** distributed under the License is distributed on an "AS IS" BASIS,
00020  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00021  ** See the License for the specific language governing permissions and
00022  ** limitations under the License.
00023  *
00024  *********************************************************************************/
00025 /*----------------------------------------------------------------------
00026           I N C L U D E S
00027 ----------------------------------------------------------------------*/
00028 #include <assert.h>
00029 #include <stdio.h>
00030 
00031 #include "associate.h"
00032 #include "render.h"
00033 #include "callcpp.h"
00034 #include "wordrec.h"
00035 
00036 // Include automatically generated configuration file if running autoconf.
00037 #ifdef HAVE_CONFIG_H
00038 #include "config_auto.h"
00039 #endif
00040 
00041 /*----------------------------------------------------------------------
00042           F u n c t i o n s
00043 ----------------------------------------------------------------------*/
00044 namespace tesseract {
00056 BLOB_CHOICE_LIST *Wordrec::classify_blob(TBLOB *blob,
00057                                          const char *string, C_COL color,
00058                                          BlamerBundle *blamer_bundle) {
00059 #ifndef GRAPHICS_DISABLED
00060   if (wordrec_display_all_blobs)
00061     display_blob(blob, color);
00062 #endif
00063   // TODO(rays) collapse with call_matcher and move all to wordrec.cpp.
00064   BLOB_CHOICE_LIST* choices = call_matcher(blob);
00065   // If a blob with the same bounding box as one of the truth character
00066   // bounding boxes is not classified as the corresponding truth character
00067   // blame character classifier for incorrect answer.
00068   if (blamer_bundle != NULL) {
00069     blamer_bundle->BlameClassifier(getDict().getUnicharset(),
00070                                    blob->bounding_box(),
00071                                    *choices,
00072                                    wordrec_debug_blamer);
00073   }
00074   #ifndef GRAPHICS_DISABLED
00075   if (classify_debug_level && string)
00076     print_ratings_list(string, choices, getDict().getUnicharset());
00077 
00078   if (wordrec_blob_pause)
00079     window_wait(blob_window);
00080 #endif
00081 
00082   return choices;
00083 }
00084 
00085 }  // namespace tesseract;
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines