tesseract 4.1.1
Loading...
Searching...
No Matches
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 "callcpp.h"
26#include "cluster.h"
27#include "ocrfeatures.h"
28#include "picofeat.h"
29#include "protos.h"
30
31#define WORST_MATCH_ALLOWED (0.9)
32#define WORST_EVIDENCE (1.0)
33#define MAX_LENGTH_MISMATCH (2.0 * GetPicoFeatureLength())
34
35#define PROTO_SUFFIX ".mf.p"
36#define CONFIG_SUFFIX ".cl"
37#define NO_PROTO (-1)
38#define XPOSITION 0
39#define YPOSITION 1
40#define MFLENGTH 2
41#define ORIENTATION 3
42
43typedef struct {
44 float MinX, MaxX, MinY, MaxY;
45} FRECT;
46
50#define CenterX(M) ((M)[XPOSITION])
51#define CenterY(M) ((M)[YPOSITION])
52#define LengthOf(M) ((M)[MFLENGTH])
53#define OrientationOf(M) ((M)[ORIENTATION])
54
58float CompareProtos(PROTO p1, PROTO p2);
59
60void ComputeMergedProto(PROTO p1, PROTO p2, float w1, float w2,
61 PROTO MergedProto);
62
63int FindClosestExistingProto(CLASS_TYPE Class, int NumMerged[],
64 PROTOTYPE* Prototype);
65
66void MakeNewFromOld(PROTO New, PROTOTYPE* Old);
67
68float SubfeatureEvidence(FEATURE Feature, PROTO Proto);
69
70double EvidenceOf(double Similarity);
71
72bool DummyFastMatch(FEATURE Feature, PROTO Proto);
73
74void ComputePaddedBoundingBox(PROTO Proto, float TangentPad,
75 float OrthogonalPad, FRECT* BoundingBox);
76
77bool PointInside(FRECT* Rectangle, float X, float Y);
78
79#endif // TESSERACT_TRAINING_MERGENF_H_
bool PointInside(FRECT *Rectangle, float X, float Y)
Definition: mergenf.cpp:317
bool DummyFastMatch(FEATURE Feature, PROTO Proto)
Definition: mergenf.cpp:259
void ComputeMergedProto(PROTO p1, PROTO p2, float w1, float w2, PROTO MergedProto)
Definition: mergenf.cpp:123
void MakeNewFromOld(PROTO New, PROTOTYPE *Old)
Definition: mergenf.cpp:193
float CompareProtos(PROTO p1, PROTO p2)
Definition: mergenf.cpp:63
double EvidenceOf(double Similarity)
Definition: mergenf.cpp:232
float SubfeatureEvidence(FEATURE Feature, PROTO Proto)
Definition: mergenf.cpp:208
void ComputePaddedBoundingBox(PROTO Proto, float TangentPad, float OrthogonalPad, FRECT *BoundingBox)
Definition: mergenf.cpp:293
int FindClosestExistingProto(CLASS_TYPE Class, int NumMerged[], PROTOTYPE *Prototype)
Definition: mergenf.cpp:155
Definition: mergenf.h:43
float MaxX
Definition: mergenf.h:44