tesseract  4.00.00dev
mergenf.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Filename: MergeNF.c
3 ** Purpose: Program for merging similar nano-feature protos
4 ** Author: Dan Johnson
5 ** History: Wed Nov 21 09:55:23 1990, DSJ, Created.
6 **
7  ** (c) Copyright Hewlett-Packard Company, 1988.
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 #ifndef TESSERACT_TRAINING_MERGENF_H_
20 #define TESSERACT_TRAINING_MERGENF_H_
21 
25 #include "protos.h"
26 #include "cluster.h"
27 #include "ocrfeatures.h"
28 #include "callcpp.h"
29 #include "picofeat.h"
30 
31 
32 #define WORST_MATCH_ALLOWED (0.9)
33 #define WORST_EVIDENCE (1.0)
34 #define MAX_LENGTH_MISMATCH (2.0 * GetPicoFeatureLength ())
35 
36 
37 #define PROTO_SUFFIX ".mf.p"
38 #define CONFIG_SUFFIX ".cl"
39 #define NO_PROTO (-1)
40 #define XPOSITION 0
41 #define YPOSITION 1
42 #define MFLENGTH 2
43 #define ORIENTATION 3
44 
45 typedef struct
46 {
47  FLOAT32 MinX, MaxX, MinY, MaxY;
48 } FRECT;
49 
53 #define CenterX(M) ( (M)[XPOSITION] )
54 #define CenterY(M) ( (M)[YPOSITION] )
55 #define LengthOf(M) ( (M)[MFLENGTH] )
56 #define OrientationOf(M) ( (M)[ORIENTATION] )
57 
62  PROTO p1,
63  PROTO p2);
64 
65 void ComputeMergedProto (
66  PROTO p1,
67  PROTO p2,
68  FLOAT32 w1,
69  FLOAT32 w2,
70  PROTO MergedProto);
71 
73  CLASS_TYPE Class,
74  int NumMerged[],
75  PROTOTYPE *Prototype);
76 
77 void MakeNewFromOld (
78  PROTO New,
79  PROTOTYPE *Old);
80 
82  FEATURE Feature,
83  PROTO Proto);
84 
85 double EvidenceOf (
86  register double Similarity);
87 
89  FEATURE Feature,
90  PROTO Proto);
91 
93  PROTO Proto,
94  FLOAT32 TangentPad,
95  FLOAT32 OrthogonalPad,
96  FRECT *BoundingBox);
97 
99  FRECT *Rectangle,
100  FLOAT32 X,
101  FLOAT32 Y);
102 
103 #endif // TESSERACT_TRAINING_MERGENF_H_
void ComputeMergedProto(PROTO p1, PROTO p2, FLOAT32 w1, FLOAT32 w2, PROTO MergedProto)
Definition: mergenf.cpp:132
int FindClosestExistingProto(CLASS_TYPE Class, int NumMerged[], PROTOTYPE *Prototype)
Definition: mergenf.cpp:166
FLOAT32 MinY
Definition: mergenf.h:47
BOOL8 PointInside(FRECT *Rectangle, FLOAT32 X, FLOAT32 Y)
Definition: mergenf.cpp:346
FLOAT32 SubfeatureEvidence(FEATURE Feature, PROTO Proto)
Definition: mergenf.cpp:222
void MakeNewFromOld(PROTO New, PROTOTYPE *Old)
Definition: mergenf.cpp:207
unsigned char BOOL8
Definition: host.h:44
FLOAT32 CompareProtos(PROTO p1, PROTO p2)
Definition: mergenf.cpp:66
float FLOAT32
Definition: host.h:42
Definition: mergenf.h:45
void ComputePaddedBoundingBox(PROTO Proto, FLOAT32 TangentPad, FLOAT32 OrthogonalPad, FRECT *BoundingBox)
Definition: mergenf.cpp:317
double EvidenceOf(register double Similarity)
BOOL8 DummyFastMatch(FEATURE Feature, PROTO Proto)
Definition: mergenf.cpp:275