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
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 ******************************************************************************/
21 #include "protos.h"
22 #include "cluster.h"
23 #include "ocrfeatures.h"
24 #include "callcpp.h"
25 #include "picofeat.h"
26
27
28 #define WORST_MATCH_ALLOWED (0.9)
29 #define WORST_EVIDENCE (1.0)
30 #define MAX_LENGTH_MISMATCH (2.0 * GetPicoFeatureLength ())
31
32
33 #define PROTO_SUFFIX ".mf.p"
34 #define CONFIG_SUFFIX ".cl"
35 #define NO_PROTO (-1)
36 #define XPOSITION 0
37 #define YPOSITION 1
38 #define MFLENGTH 2
39 #define ORIENTATION 3
40
41 typedef struct
42 {
43 FLOAT32 MinX, MaxX, MinY, MaxY;
44 } FRECT;
45
49 #define CenterX(M) ( (M)[XPOSITION] )
50 #define CenterY(M) ( (M)[YPOSITION] )
51 #define LengthOf(M) ( (M)[MFLENGTH] )
52 #define OrientationOf(M) ( (M)[ORIENTATION] )
53
57 FLOAT32 CompareProtos (
58 PROTO p1,
59 PROTO p2);
60
61 void ComputeMergedProto (
62 PROTO p1,
63 PROTO p2,
64 FLOAT32 w1,
65 FLOAT32 w2,
66 PROTO MergedProto);
67
68 int FindClosestExistingProto (
69 CLASS_TYPE Class,
70 int NumMerged[],
71 PROTOTYPE *Prototype);
72
73 void MakeNewFromOld (
74 PROTO New,
75 PROTOTYPE *Old);
76
77 FLOAT32 SubfeatureEvidence (
78 FEATURE Feature,
79 PROTO Proto);
80
81 double EvidenceOf (
82 register double Similarity);
83
84 BOOL8 DummyFastMatch (
85 FEATURE Feature,
86 PROTO Proto);
87
88 void ComputePaddedBoundingBox (
89 PROTO Proto,
90 FLOAT32 TangentPad,
91 FLOAT32 OrthogonalPad,
92 FRECT *BoundingBox);
93
94 BOOL8 PointInside (
95 FRECT *Rectangle,
96 FLOAT32 X,
97 FLOAT32 Y);