tesseract v5.3.3.20231005
|
#include <algorithm>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstring>
#include "cluster.h"
#include "clusttool.h"
#include "featdefs.h"
#include "intproto.h"
#include "mergenf.h"
#include "ocrfeatures.h"
#include "oldlist.h"
#include "params.h"
#include "protos.h"
Go to the source code of this file.
Macros | |
#define | _USE_MATH_DEFINES |
Functions | |
float | CompareProtos (PROTO_STRUCT *p1, PROTO_STRUCT *p2) |
void | ComputeMergedProto (PROTO_STRUCT *p1, PROTO_STRUCT *p2, float w1, float w2, PROTO_STRUCT *MergedProto) |
int | FindClosestExistingProto (CLASS_TYPE Class, int NumMerged[], PROTOTYPE *Prototype) |
void | MakeNewFromOld (PROTO_STRUCT *New, PROTOTYPE *Old) |
SubfeatureEvidence | |
Compare a feature to a prototype. Print the result. | |
float | SubfeatureEvidence (FEATURE Feature, PROTO_STRUCT *Proto) |
EvidenceOf | |
Return the new type of evidence number corresponding to this distance value. This number is no longer based on the chi squared approximation. The equation that represents the transform is: 1 / (1 + (sim / midpoint) ^ curl) | |
double | EvidenceOf (double Similarity) |
bool | DummyFastMatch (FEATURE Feature, PROTO_STRUCT *Proto) |
void | ComputePaddedBoundingBox (PROTO_STRUCT *Proto, float TangentPad, float OrthogonalPad, FRECT *BoundingBox) |
bool | PointInside (FRECT *Rectangle, float X, float Y) |
#define _USE_MATH_DEFINES |
Definition at line 18 of file mergenf.cpp.
float CompareProtos | ( | PROTO_STRUCT * | p1, |
PROTO_STRUCT * | p2 | ||
) |
Compare protos p1 and p2 and return an estimate of the worst evidence rating that will result for any part of p1 that is compared to p2. In other words, if p1 were broken into pico-features and each pico-feature was matched to p2, what is the worst evidence rating that will be achieved for any pico-feature.
p1,p2 | protos to be compared |
Globals: none
Definition at line 66 of file mergenf.cpp.
void ComputeMergedProto | ( | PROTO_STRUCT * | p1, |
PROTO_STRUCT * | p2, | ||
float | w1, | ||
float | w2, | ||
PROTO_STRUCT * | MergedProto | ||
) |
This routine computes a proto which is the weighted average of protos p1 and p2. The new proto is returned in MergedProto.
p1,p2 | protos to be merged |
w1,w2 | weight of each proto |
MergedProto | place to put resulting merged proto |
Definition at line 130 of file mergenf.cpp.
void ComputePaddedBoundingBox | ( | PROTO_STRUCT * | Proto, |
float | TangentPad, | ||
float | OrthogonalPad, | ||
FRECT * | BoundingBox | ||
) |
This routine computes a bounding box that encloses the specified proto along with some padding. The amount of padding is specified as separate distances in the tangential and orthogonal directions.
Proto | proto to compute bounding box for | |
TangentPad | amount of pad to add in direction of segment | |
OrthogonalPad | amount of pad to add orthogonal to segment | |
[out] | BoundingBox | place to put results |
Definition at line 295 of file mergenf.cpp.
bool DummyFastMatch | ( | FEATURE | Feature, |
PROTO_STRUCT * | Proto | ||
) |
This routine returns true if Feature would be matched by a fast match table built from Proto.
Feature | feature to be "fast matched" to proto |
Proto | proto being "fast matched" against |
Globals:
Definition at line 263 of file mergenf.cpp.
double EvidenceOf | ( | double | Similarity | ) |
Definition at line 236 of file mergenf.cpp.
int FindClosestExistingProto | ( | CLASS_TYPE | Class, |
int | NumMerged[], | ||
PROTOTYPE * | Prototype | ||
) |
This routine searches through all of the prototypes in Class and returns the id of the proto which would provide the best approximation of Prototype. If no close approximation can be found, NO_PROTO is returned.
Class | class to search for matching old proto in |
NumMerged | # of protos merged into each proto of Class |
Prototype | new proto to find match for |
Globals: none
Definition at line 158 of file mergenf.cpp.
void MakeNewFromOld | ( | PROTO_STRUCT * | New, |
PROTOTYPE * | Old | ||
) |
This fills in the fields of the New proto based on the fields of the Old proto.
New | new proto to be filled in |
Old | old proto to be converted |
Globals: none
Definition at line 194 of file mergenf.cpp.
bool PointInside | ( | FRECT * | Rectangle, |
float | X, | ||
float | Y | ||
) |
Return true if point (X,Y) is inside of Rectangle.
Globals: none
Definition at line 319 of file mergenf.cpp.
float SubfeatureEvidence | ( | FEATURE | Feature, |
PROTO_STRUCT * | Proto | ||
) |
Definition at line 209 of file mergenf.cpp.