tesseract  5.0.0
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  **
6  ** (c) Copyright Hewlett-Packard Company, 1988.
7  ** Licensed under the Apache License, Version 2.0 (the "License");
8  ** you may not use this file except in compliance with the License.
9  ** You may obtain a copy of the License at
10  ** http://www.apache.org/licenses/LICENSE-2.0
11  ** Unless required by applicable law or agreed to in writing, software
12  ** distributed under the License is distributed on an "AS IS" BASIS,
13  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  ** See the License for the specific language governing permissions and
15  ** limitations under the License.
16  *****************************************************************************/
17 
18 #ifndef TESSERACT_TRAINING_MERGENF_H_
19 #define TESSERACT_TRAINING_MERGENF_H_
20 
24 #include "cluster.h"
25 #include "ocrfeatures.h"
26 #include "picofeat.h"
27 #include "protos.h"
28 
29 #define WORST_MATCH_ALLOWED (0.9)
30 #define WORST_EVIDENCE (1.0)
31 #define MAX_LENGTH_MISMATCH (2.0 * GetPicoFeatureLength())
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 struct FRECT {
42  float MinX, MaxX, MinY, MaxY;
43 };
44 
48 #define CenterX(M) ((M)[XPOSITION])
49 #define CenterY(M) ((M)[YPOSITION])
50 #define LengthOf(M) ((M)[MFLENGTH])
51 #define OrientationOf(M) ((M)[ORIENTATION])
52 
57 
59  tesseract::PROTO_STRUCT *MergedProto);
60 
61 int FindClosestExistingProto(tesseract::CLASS_TYPE Class, int NumMerged[],
62  tesseract::PROTOTYPE *Prototype);
63 
65 
67 
68 double EvidenceOf(double Similarity);
69 
71 
72 void ComputePaddedBoundingBox(tesseract::PROTO_STRUCT *Proto, float TangentPad, float OrthogonalPad,
73  FRECT *BoundingBox);
74 
75 bool PointInside(FRECT *Rectangle, float X, float Y);
76 
77 #endif // TESSERACT_TRAINING_MERGENF_H_
bool PointInside(FRECT *Rectangle, float X, float Y)
Definition: mergenf.cpp:319
float CompareProtos(tesseract::PROTO_STRUCT *p1, tesseract::PROTO_STRUCT *p2)
Definition: mergenf.cpp:66
bool DummyFastMatch(tesseract::FEATURE Feature, tesseract::PROTO_STRUCT *Proto)
Definition: mergenf.cpp:263
double EvidenceOf(double Similarity)
Definition: mergenf.cpp:236
void ComputePaddedBoundingBox(tesseract::PROTO_STRUCT *Proto, float TangentPad, float OrthogonalPad, FRECT *BoundingBox)
Definition: mergenf.cpp:295
void ComputeMergedProto(tesseract::PROTO_STRUCT *p1, tesseract::PROTO_STRUCT *p2, float w1, float w2, tesseract::PROTO_STRUCT *MergedProto)
Definition: mergenf.cpp:130
int FindClosestExistingProto(tesseract::CLASS_TYPE Class, int NumMerged[], tesseract::PROTOTYPE *Prototype)
Definition: mergenf.cpp:158
void MakeNewFromOld(tesseract::PROTO_STRUCT *New, tesseract::PROTOTYPE *Old)
Definition: mergenf.cpp:194
float SubfeatureEvidence(tesseract::FEATURE Feature, tesseract::PROTO_STRUCT *Proto)
Definition: mergenf.cpp:209
Definition: mergenf.h:41
float MaxY
Definition: mergenf.h:42
float MinX
Definition: mergenf.h:42
float MinY
Definition: mergenf.h:42
float MaxX
Definition: mergenf.h:42