All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 
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 
69  CLASS_TYPE Class,
70  int NumMerged[],
71  PROTOTYPE *Prototype);
72 
73 void MakeNewFromOld (
74  PROTO New,
75  PROTOTYPE *Old);
76 
78  FEATURE Feature,
79  PROTO Proto);
80 
81 double EvidenceOf (
82  register double Similarity);
83 
85  FEATURE Feature,
86  PROTO Proto);
87 
89  PROTO Proto,
90  FLOAT32 TangentPad,
91  FLOAT32 OrthogonalPad,
92  FRECT *BoundingBox);
93 
95  FRECT *Rectangle,
96  FLOAT32 X,
97  FLOAT32 Y);
FLOAT32 SubfeatureEvidence(FEATURE Feature, PROTO Proto)
Definition: mergenf.cpp:223
float FLOAT32
Definition: host.h:111
void ComputeMergedProto(PROTO p1, PROTO p2, FLOAT32 w1, FLOAT32 w2, PROTO MergedProto)
Definition: mergenf.cpp:133
void ComputePaddedBoundingBox(PROTO Proto, FLOAT32 TangentPad, FLOAT32 OrthogonalPad, FRECT *BoundingBox)
Definition: mergenf.cpp:318
FLOAT32 CompareProtos(PROTO p1, PROTO p2)
Definition: mergenf.cpp:67
unsigned char BOOL8
Definition: host.h:113
double EvidenceOf(register double Similarity)
FLOAT32 MinY
Definition: mergenf.h:43
void MakeNewFromOld(PROTO New, PROTOTYPE *Old)
Definition: mergenf.cpp:208
Definition: mergenf.h:41
BOOL8 PointInside(FRECT *Rectangle, FLOAT32 X, FLOAT32 Y)
Definition: mergenf.cpp:347
int FindClosestExistingProto(CLASS_TYPE Class, int NumMerged[], PROTOTYPE *Prototype)
Definition: mergenf.cpp:167
BOOL8 DummyFastMatch(FEATURE Feature, PROTO Proto)
Definition: mergenf.cpp:276