tesseract  3.03
/usr/local/google/home/jbreiden/tesseract-ocr-read-only/textord/fpchop.h
Go to the documentation of this file.
00001 /**********************************************************************
00002  * File:        fpchop.h  (Formerly fp_chop.h)
00003  * Description: Code to chop fixed pitch text into character cells.
00004  * Author:              Ray Smith
00005  * Created:             Thu Sep 16 11:14:15 BST 1993
00006  *
00007  * (C) Copyright 1993, 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           FPCHOP_H
00021 #define           FPCHOP_H
00022 
00023 #include          "params.h"
00024 #include          "blobbox.h"
00025 
00026 class C_OUTLINE_FRAG:public ELIST_LINK
00027 {
00028   public:
00029     C_OUTLINE_FRAG() {  //empty constructor
00030       steps = NULL;
00031       stepcount = 0;
00032     }
00033     ~C_OUTLINE_FRAG () {
00034       if (steps != NULL)
00035         delete [] steps;
00036     }
00037                                  //start coord
00038     C_OUTLINE_FRAG(ICOORD start_pt,
00039                    ICOORD end_pt,       //end coord
00040                    C_OUTLINE *outline,  //source of steps
00041                    inT16 start_index,
00042                    inT16 end_index);
00043                                  //other end
00044     C_OUTLINE_FRAG(C_OUTLINE_FRAG *head, inT16 tail_y);
00045     C_OUTLINE *close();  //copy to outline
00046     C_OUTLINE_FRAG & operator= ( //assign
00047       const C_OUTLINE_FRAG & src);
00048 
00049     ICOORD start;                //start coord
00050     ICOORD end;                  //end coord
00051     DIR128 *steps;                //step array
00052     inT32 stepcount;             //no of steps
00053     C_OUTLINE_FRAG *other_end;   //head if a tail
00054     inT16 ycoord;                //coord of cut pt
00055 
00056   private:
00057 };
00058 
00059 ELISTIZEH(C_OUTLINE_FRAG)
00060 
00061 extern
00062 INT_VAR_H (textord_fp_chop_error, 2,
00063 "Max allowed bending of chop cells");
00064 extern
00065 double_VAR_H (textord_fp_chop_snap, 0.5,
00066 "Max distance of chop pt from vertex");
00067 ROW *fixed_pitch_words(                 //find lines
00068                        TO_ROW *row,     //row to do
00069                        FCOORD rotation  //for drawing
00070                       );
00071 WERD *add_repeated_word(                         //move repeated word
00072                         WERD_IT *rep_it,         //repeated words
00073                         inT16 &rep_left,         //left edge of word
00074                         inT16 &prev_chop_coord,  //previous word end
00075                         uinT8 &blanks,           //no of blanks
00076                         float pitch,             //char cell size
00077                         WERD_IT *word_it         //list of words
00078                        );
00079 void split_to_blob(                                 //split the blob
00080                    BLOBNBOX *blob,                  //blob to split
00081                    inT16 chop_coord,                //place to chop
00082                    float pitch_error,               //allowed deviation
00083                    C_OUTLINE_LIST *left_coutlines,  //for cblobs
00084                    C_OUTLINE_LIST *right_coutlines);
00085 void fixed_chop_cblob(                                //split the blob
00086                       C_BLOB *blob,                   //blob to split
00087                       inT16 chop_coord,               //place to chop
00088                       float pitch_error,              //allowed deviation
00089                       C_OUTLINE_LIST *left_outlines,  //left half of chop
00090                       C_OUTLINE_LIST *right_outlines  //right half of chop
00091                      );
00092 void fixed_split_coutline(                        //chop the outline
00093                           C_OUTLINE *srcline,     //source outline
00094                           inT16 chop_coord,       //place to chop
00095                           float pitch_error,      //allowed deviation
00096                           C_OUTLINE_IT *left_it,  //left half of chop
00097                           C_OUTLINE_IT *right_it  //right half of chop
00098                          );
00099 BOOL8 fixed_chop_coutline(                                  //chop the outline
00100                           C_OUTLINE *srcline,               //source outline
00101                           inT16 chop_coord,                 //place to chop
00102                           float pitch_error,                //allowed deviation
00103                           C_OUTLINE_FRAG_LIST *left_frags,  //left half of chop
00104                           C_OUTLINE_FRAG_LIST *right_frags  //right half of chop
00105                          );
00106 void save_chop_cfragment(                            //chop the outline
00107                          inT16 head_index,           //head of fragment
00108                          ICOORD head_pos,            //head of fragment
00109                          inT16 tail_index,           //tail of fragment
00110                          ICOORD tail_pos,            //tail of fragment
00111                          C_OUTLINE *srcline,         //source of edgesteps
00112                          C_OUTLINE_FRAG_LIST *frags  //fragment list
00113                         );
00114 void add_frag_to_list(                            //ordered add
00115                       C_OUTLINE_FRAG *frag,       //fragment to add
00116                       C_OUTLINE_FRAG_LIST *frags  //fragment list
00117                      );
00118 void close_chopped_cfragments(                             //chop the outline
00119                               C_OUTLINE_FRAG_LIST *frags,  //list to clear
00120                               C_OUTLINE_LIST *children,    //potential children
00121                               float pitch_error,           //allowed shrinkage
00122                               C_OUTLINE_IT *dest_it        //output list
00123                              );
00124 C_OUTLINE *join_chopped_fragments(                         //join pieces
00125                                   C_OUTLINE_FRAG *bottom,  //bottom of cut
00126                                   C_OUTLINE_FRAG *top      //top of cut
00127                                  );
00128 void join_segments(                         //join pieces
00129                    C_OUTLINE_FRAG *bottom,  //bottom of cut
00130                    C_OUTLINE_FRAG *top      //top of cut
00131                   );
00132 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines