1 /********************************************************************** 2 * File: wordseg.h (Formerly wspace.h) 3 * Description: Code to segment the blobs into words. 4 * Author: Ray Smith 5 * 6 * (C) Copyright 1992, Hewlett-Packard Ltd. 7 ** Licensed under the Apache License, Version 2.0 (the "License"); 8 ** you may not use this file except in compliance with the License. 9 ** You may obtain a copy of the License at 10 ** http://www.apache.org/licenses/LICENSE-2.0 11 ** Unless required by applicable law or agreed to in writing, software 12 ** distributed under the License is distributed on an "AS IS" BASIS, 13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 ** See the License for the specific language governing permissions and 15 ** limitations under the License. 16 * 17 **********************************************************************/ 18 19 #ifndef WORDSEG_H 20 #define WORDSEG_H 21 22 #include "blobbox.h" 23 #include "params.h" 24 #include "textord.h" 25 26 namespace tesseract { 27 class Tesseract; 28 29 extern BOOL_VAR_H(textord_force_make_prop_words); 30 extern BOOL_VAR_H(textord_chopper_test); 31 32 void make_single_word(bool one_blob, TO_ROW_LIST *rows, ROW_LIST *real_rows); 33 void make_words(tesseract::Textord *textord, 34 ICOORD page_tr, // top right 35 float gradient, // page skew 36 BLOCK_LIST *blocks, // block list 37 TO_BLOCK_LIST *port_blocks); // output list 38 void set_row_spaces( // find space sizes 39 TO_BLOCK *block, // block to do 40 FCOORD rotation, // for drawing 41 bool testing_on // correct orientation 42 ); 43 int32_t row_words( // compute space size 44 TO_BLOCK *block, // block it came from 45 TO_ROW *row, // row to operate on 46 int32_t maxwidth, // max expected space size 47 FCOORD rotation, // for drawing 48 bool testing_on // for debug 49 ); 50 int32_t row_words2( // compute space size 51 TO_BLOCK *block, // block it came from 52 TO_ROW *row, // row to operate on 53 int32_t maxwidth, // max expected space size 54 FCOORD rotation, // for drawing 55 bool testing_on // for debug 56 ); 57 void make_real_words(tesseract::Textord *textord, 58 TO_BLOCK *block, // block to do 59 FCOORD rotation // for drawing 60 ); 61 ROW *make_rep_words( // make a row 62 TO_ROW *row, // row to convert 63 TO_BLOCK *block // block it lives in 64 ); 65 WERD *make_real_word( // make a WERD 66 BLOBNBOX_IT *box_it, // iterator 67 int32_t blobcount, // no of blobs to use 68 bool bol, // start of line 69 uint8_t blanks // no of blanks 70 ); 71 72 } // namespace tesseract 73 74 #endif 75