Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pitsync1.h
Go to the documentation of this file.
1 /**********************************************************************
2 * File: pitsync1.h (Formerly pitsync.h)
3 * Description: Code to find the optimum fixed pitch segmentation of some blobs.
4 * Author: Ray Smith
5 * Created: Thu Nov 19 11:48:05 GMT 1992
6 *
7 * (C) Copyright 1992, Hewlett-Packard Ltd.
8 ** Licensed under the Apache License, Version 2.0 (the "License");
9 ** you may not use this file except in compliance with the License.
10 ** You may obtain a copy of the License at
11 ** http://www.apache.org/licenses/LICENSE-2.0
12 ** Unless required by applicable law or agreed to in writing, software
13 ** distributed under the License is distributed on an "AS IS" BASIS,
14 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 ** See the License for the specific language governing permissions and
16 ** limitations under the License.
17 *
18 **********************************************************************/
19
20 #ifndef PITSYNC1_H
21 #define PITSYNC1_H
22
23 #include "elst.h"
24 #include "clst.h"
25 #include "blobbox.h"
26 #include "params.h"
27 #include "statistc.h"
28 #include "pithsync.h"
29 #include "notdll.h"
30 #include "notdll.h"
31
32 class FPSEGPT_LIST;
33
34 class FPSEGPT:public ELIST_LINK
35 {
36 public:
37 FPSEGPT() { //empty
38 }
39 FPSEGPT( //constructor
40 inT16 x); //position
41 FPSEGPT( //constructor
42 inT16 x, //position
43 BOOL8 faking, //faking this one
44 inT16 offset, //extra cost dist
45 inT16 region_index, //segment number
46 inT16 pitch, //proposed pitch
47 inT16 pitch_error, //allowed tolerance
48 FPSEGPT_LIST *prev_list); //previous segment
49 FPSEGPT(FPCUTPT *cutpt); //build from new type
50
51 inT32 position() { //acces func
52 return xpos;
53 }
54 double cost_function() {
55 return cost;
56 }
57 double squares() {
58 return sq_sum;
59 }
60 double sum() {
61 return mean_sum;
62 }
63 FPSEGPT *previous() {
64 return pred;
65 }
66 inT16 cheap_cuts() const { //no of cheap cuts
67 return mid_cuts;
68 }
69
70 //faked split point
71 BOOL8 faked;
72 BOOL8 terminal; //successful end
73 inT16 fake_count; //total fakes to here
74
75 private:
76 inT16 mid_cuts; //no of cheap cuts
77 inT32 xpos; //location
78 FPSEGPT *pred; //optimal previous
79 double mean_sum; //mean so far
80 double sq_sum; //summed distsances
81 double cost; //cost function
82 };
83
84 ELISTIZEH (FPSEGPT) CLISTIZEH (FPSEGPT_LIST)
85 extern
86 INT_VAR_H (pitsync_linear_version, 0, "Use new fast algorithm");
87 extern
88 double_VAR_H (pitsync_joined_edge, 0.75,
89 "Dist inside big blob for chopping");
90 extern
91 double_VAR_H (pitsync_offset_freecut_fraction, 0.25,
92 "Fraction of cut for free cuts");
93 extern
94 INT_VAR_H (pitsync_fake_depth, 1, "Max advance fake generation");
95 double check_pitch_sync( //find segmentation
96 BLOBNBOX_IT *blob_it, //blobs to do
97 inT16 blob_count, //no of blobs
98 inT16 pitch, //pitch estimate
99 inT16 pitch_error, //tolerance
100 STATS *projection, //vertical
101 FPSEGPT_LIST *seg_list //output list
102 );
103 void make_illegal_segment( //find segmentation
104 FPSEGPT_LIST *prev_list, //previous segments
105 TBOX blob_box, //bounding box
106 BLOBNBOX_IT blob_it, //iterator
107 inT16 region_index, //number of segment
108 inT16 pitch, //pitch estimate
109 inT16 pitch_error, //tolerance
110 FPSEGPT_LIST *seg_list //output list
111 );
112 inT16 vertical_torow_projection( //project whole row
113 TO_ROW *row, //row to do
114 STATS *projection //output
115 );
116 void vertical_cblob_projection( //project outlines
117 C_BLOB *blob, //blob to project
118 STATS *stats //output
119 );
120 void vertical_coutline_projection( //project outlines
121 C_OUTLINE *outline, //outline to project
122 STATS *stats //output
123 );
124 #endif