tesseract  3.03
/usr/local/google/home/jbreiden/tesseract-ocr-read-only/textord/pitsync1.h
Go to the documentation of this file.
00001 /**********************************************************************
00002  * File:        pitsync1.h  (Formerly pitsync.h)
00003  * Description: Code to find the optimum fixed pitch segmentation of some blobs.
00004  * Author:              Ray Smith
00005  * Created:             Thu Nov 19 11:48:05 GMT 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           PITSYNC1_H
00021 #define           PITSYNC1_H
00022 
00023 #include          "elst.h"
00024 #include          "clst.h"
00025 #include          "blobbox.h"
00026 #include          "params.h"
00027 #include          "statistc.h"
00028 #include          "pithsync.h"
00029 
00030 class FPSEGPT_LIST;
00031 
00032 class FPSEGPT:public ELIST_LINK
00033 {
00034   public:
00035     FPSEGPT() {  //empty
00036     }
00037     FPSEGPT(           //constructor
00038             inT16 x);  //position
00039     FPSEGPT(                           //constructor
00040             inT16 x,                   //position
00041             BOOL8 faking,              //faking this one
00042             inT16 offset,              //extra cost dist
00043             inT16 region_index,        //segment number
00044             inT16 pitch,               //proposed pitch
00045             inT16 pitch_error,         //allowed tolerance
00046             FPSEGPT_LIST *prev_list);  //previous segment
00047     FPSEGPT(FPCUTPT *cutpt);  //build from new type
00048 
00049     inT32 position() {  //acces func
00050       return xpos;
00051     }
00052     double cost_function() {
00053       return cost;
00054     }
00055     double squares() {
00056       return sq_sum;
00057     }
00058     double sum() {
00059       return mean_sum;
00060     }
00061     FPSEGPT *previous() {
00062       return pred;
00063     }
00064     inT16 cheap_cuts() const {  //no of cheap cuts
00065       return mid_cuts;
00066     }
00067 
00068                                  //faked split point
00069     BOOL8 faked;
00070     BOOL8 terminal;              //successful end
00071     inT16 fake_count;            //total fakes to here
00072 
00073   private:
00074     inT16 mid_cuts;              //no of cheap cuts
00075     inT32 xpos;                  //location
00076     FPSEGPT *pred;               //optimal previous
00077     double mean_sum;             //mean so far
00078     double sq_sum;               //summed distsances
00079     double cost;                 //cost function
00080 };
00081 
00082 ELISTIZEH (FPSEGPT) CLISTIZEH (FPSEGPT_LIST)
00083 extern
00084 INT_VAR_H (pitsync_linear_version, 0, "Use new fast algorithm");
00085 extern
00086 double_VAR_H (pitsync_joined_edge, 0.75,
00087 "Dist inside big blob for chopping");
00088 extern
00089 double_VAR_H (pitsync_offset_freecut_fraction, 0.25,
00090 "Fraction of cut for free cuts");
00091 extern
00092 INT_VAR_H (pitsync_fake_depth, 1, "Max advance fake generation");
00093 double check_pitch_sync(                        //find segmentation
00094                         BLOBNBOX_IT *blob_it,   //blobs to do
00095                         inT16 blob_count,       //no of blobs
00096                         inT16 pitch,            //pitch estimate
00097                         inT16 pitch_error,      //tolerance
00098                         STATS *projection,      //vertical
00099                         FPSEGPT_LIST *seg_list  //output list
00100                        );
00101 void make_illegal_segment(                          //find segmentation
00102                           FPSEGPT_LIST *prev_list,  //previous segments
00103                           TBOX blob_box,             //bounding box
00104                           BLOBNBOX_IT blob_it,      //iterator
00105                           inT16 region_index,       //number of segment
00106                           inT16 pitch,              //pitch estimate
00107                           inT16 pitch_error,        //tolerance
00108                           FPSEGPT_LIST *seg_list    //output list
00109                          );
00110 inT16 vertical_torow_projection(                   //project whole row
00111                                 TO_ROW *row,       //row to do
00112                                 STATS *projection  //output
00113                                );
00114 void vertical_cblob_projection(               //project outlines
00115                                C_BLOB *blob,  //blob to project
00116                                STATS *stats   //output
00117                               );
00118 void vertical_coutline_projection(                     //project outlines
00119                                   C_OUTLINE *outline,  //outline to project
00120                                   STATS *stats         //output
00121                                  );
00122 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines