All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 
30 class FPSEGPT_LIST;
31 
32 class FPSEGPT:public ELIST_LINK
33 {
34  public:
35  FPSEGPT() { //empty
36  }
37  FPSEGPT( //constructor
38  inT16 x); //position
39  FPSEGPT( //constructor
40  inT16 x, //position
41  BOOL8 faking, //faking this one
42  inT16 offset, //extra cost dist
43  inT16 region_index, //segment number
44  inT16 pitch, //proposed pitch
45  inT16 pitch_error, //allowed tolerance
46  FPSEGPT_LIST *prev_list); //previous segment
47  FPSEGPT(FPCUTPT *cutpt); //build from new type
48 
49  inT32 position() { //acces func
50  return xpos;
51  }
52  double cost_function() {
53  return cost;
54  }
55  double squares() {
56  return sq_sum;
57  }
58  double sum() {
59  return mean_sum;
60  }
62  return pred;
63  }
64  inT16 cheap_cuts() const { //no of cheap cuts
65  return mid_cuts;
66  }
67 
68  //faked split point
70  BOOL8 terminal; //successful end
71  inT16 fake_count; //total fakes to here
72 
73  private:
74  inT16 mid_cuts; //no of cheap cuts
75  inT32 xpos; //location
76  FPSEGPT *pred; //optimal previous
77  double mean_sum; //mean so far
78  double sq_sum; //summed distsances
79  double cost; //cost function
80 };
81 
82 ELISTIZEH (FPSEGPT) CLISTIZEH (FPSEGPT_LIST)
83 extern
84 INT_VAR_H (pitsync_linear_version, 0, "Use new fast algorithm");
85 extern
87 "Dist inside big blob for chopping");
88 extern
90 "Fraction of cut for free cuts");
91 extern
92 INT_VAR_H (pitsync_fake_depth, 1, "Max advance fake generation");
93 double check_pitch_sync( //find segmentation
94  BLOBNBOX_IT *blob_it, //blobs to do
95  inT16 blob_count, //no of blobs
96  inT16 pitch, //pitch estimate
97  inT16 pitch_error, //tolerance
98  STATS *projection, //vertical
99  FPSEGPT_LIST *seg_list //output list
100  );
101 void make_illegal_segment( //find segmentation
102  FPSEGPT_LIST *prev_list, //previous segments
103  TBOX blob_box, //bounding box
104  BLOBNBOX_IT blob_it, //iterator
105  inT16 region_index, //number of segment
106  inT16 pitch, //pitch estimate
107  inT16 pitch_error, //tolerance
108  FPSEGPT_LIST *seg_list //output list
109  );
110 inT16 vertical_torow_projection( //project whole row
111  TO_ROW *row, //row to do
112  STATS *projection //output
113  );
114 void vertical_cblob_projection( //project outlines
115  C_BLOB *blob, //blob to project
116  STATS *stats //output
117  );
118 void vertical_coutline_projection( //project outlines
119  C_OUTLINE *outline, //outline to project
120  STATS *stats //output
121  );
122 #endif
double pitsync_joined_edge
Definition: pitsync1.cpp:33
double pitsync_offset_freecut_fraction
Definition: pitsync1.cpp:36
#define CLISTIZEH(CLASSNAME)
Definition: clst.h:946
double squares()
Definition: pitsync1.h:55
FPSEGPT()
Definition: pitsync1.h:35
#define INT_VAR_H(name, val, comment)
Definition: params.h:265
Definition: statistc.h:33
int pitsync_fake_depth
Definition: pitsync1.cpp:38
unsigned char BOOL8
Definition: host.h:113
double check_pitch_sync(BLOBNBOX_IT *blob_it, inT16 blob_count, inT16 pitch, inT16 pitch_error, STATS *projection, FPSEGPT_LIST *seg_list)
Definition: pitsync1.cpp:148
inT16 fake_count
Definition: pitsync1.h:71
BOOL8 faked
Definition: pitsync1.h:69
void vertical_cblob_projection(C_BLOB *blob, STATS *stats)
Definition: blobbox.cpp:861
EndParamDesc of
Definition: featdefs.cpp:108
inT16 vertical_torow_projection(TO_ROW *row, STATS *projection)
BOOL8 terminal
Definition: pitsync1.h:70
inT16 cheap_cuts() const
Definition: pitsync1.h:64
#define double_VAR_H(name, val, comment)
Definition: params.h:274
FPSEGPT * previous()
Definition: pitsync1.h:61
double cost_function()
Definition: pitsync1.h:52
Definition: rect.h:30
ELISTIZEH(FPSEGPT) CLISTIZEH(FPSEGPT_LIST) extern int pitsync_linear_version=0
double sum()
Definition: pitsync1.h:58
inT32 position()
Definition: pitsync1.h:49
void make_illegal_segment(FPSEGPT_LIST *prev_list, TBOX blob_box, BLOBNBOX_IT blob_it, inT16 region_index, inT16 pitch, inT16 pitch_error, FPSEGPT_LIST *seg_list)
Definition: pitsync1.cpp:366
void vertical_coutline_projection(C_OUTLINE *outline, STATS *stats)
Definition: blobbox.cpp:881
short inT16
Definition: host.h:100
int inT32
Definition: host.h:102