tesseract
3.03
|
00001 /********************************************************************** 00002 * File: wordseg.h (Formerly wspace.h) 00003 * Description: Code to segment the blobs into words. 00004 * Author: Ray Smith 00005 * Created: Fri Oct 16 11:32:28 BST 1992 00006 * 00007 * (C) Copyright 1992, Hewlett-Packard Ltd. 00008 ** Licensed under the Apache License, Version 2.0 (the "License"); 00009 ** you may not use this file except in compliance with the License. 00010 ** You may obtain a copy of the License at 00011 ** http://www.apache.org/licenses/LICENSE-2.0 00012 ** Unless required by applicable law or agreed to in writing, software 00013 ** distributed under the License is distributed on an "AS IS" BASIS, 00014 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 ** See the License for the specific language governing permissions and 00016 ** limitations under the License. 00017 * 00018 **********************************************************************/ 00019 00020 #ifndef WORDSEG_H 00021 #define WORDSEG_H 00022 00023 #include "params.h" 00024 #include "blobbox.h" 00025 #include "textord.h" 00026 00027 namespace tesseract { 00028 class Tesseract; 00029 } 00030 00031 extern BOOL_VAR_H (textord_fp_chopping, TRUE, "Do fixed pitch chopping"); 00032 extern BOOL_VAR_H(textord_force_make_prop_words, FALSE, 00033 "Force proportional word segmentation on all rows"); 00034 extern BOOL_VAR_H (textord_chopper_test, FALSE, 00035 "Chopper is being tested."); 00036 00037 void make_single_word(bool one_blob, TO_ROW_LIST *rows, ROW_LIST* real_rows); 00038 void make_words(tesseract::Textord *textord, 00039 ICOORD page_tr, // top right 00040 float gradient, // page skew 00041 BLOCK_LIST *blocks, // block list 00042 TO_BLOCK_LIST *port_blocks); // output list 00043 void set_row_spaces( //find space sizes 00044 TO_BLOCK *block, //block to do 00045 FCOORD rotation, //for drawing 00046 BOOL8 testing_on //correct orientation 00047 ); 00048 inT32 row_words( //compute space size 00049 TO_BLOCK *block, //block it came from 00050 TO_ROW *row, //row to operate on 00051 inT32 maxwidth, //max expected space size 00052 FCOORD rotation, //for drawing 00053 BOOL8 testing_on //for debug 00054 ); 00055 inT32 row_words2( //compute space size 00056 TO_BLOCK *block, //block it came from 00057 TO_ROW *row, //row to operate on 00058 inT32 maxwidth, //max expected space size 00059 FCOORD rotation, //for drawing 00060 BOOL8 testing_on //for debug 00061 ); 00062 void make_real_words( 00063 tesseract::Textord *textord, 00064 TO_BLOCK *block, //block to do 00065 FCOORD rotation //for drawing 00066 ); 00067 ROW *make_rep_words( //make a row 00068 TO_ROW *row, //row to convert 00069 TO_BLOCK *block //block it lives in 00070 ); 00071 WERD *make_real_word( //make a WERD 00072 BLOBNBOX_IT *box_it, //iterator 00073 inT32 blobcount, //no of blobs to use 00074 BOOL8 bol, //start of line 00075 uinT8 blanks //no of blanks 00076 ); 00077 #endif