77 Angle = p1->
Angle * 2.0 * M_PI;
81 if (Length < 0) Length = 0;
88 if (Evidence < WorstEvidence)
89 WorstEvidence = Evidence;
100 if (Evidence < WorstEvidence)
101 WorstEvidence = Evidence;
108 return (WorstEvidence);
132 TotalWeight = w1 + w2;
136 MergedProto->
X = p1->
X * w1 + p2->
X * w2;
137 MergedProto->
Y = p1->
Y * w1 + p2->
Y * w2;
165 float Match, OldMatch, NewMatch;
171 for (Pid = 0; Pid < Class->
NumProtos; Pid++) {
174 (
float) NumMerged[Pid], 1.0, &MergedProto);
177 Match = std::min(OldMatch, NewMatch);
178 if (Match > BestMatch) {
215 if (Dangle < -0.5) Dangle += 1.0;
216 if (Dangle > 0.5) Dangle -= 1.0;
223 return (
EvidenceOf (Distance * Distance + Dangle * Dangle));
239 Similarity = Similarity * Similarity * Similarity;
241 Similarity = Similarity * Similarity;
245 return (1.0 / (1.0 + Similarity));
269 if (AngleError > 0.5)
270 AngleError = 1.0 - AngleError;
272 if (AngleError > MaxAngleError)
300 float OrthogonalPad,
FRECT *BoundingBox) {
301 float Length = Proto->
Length / 2.0 + TangentPad;
302 float Angle = Proto->
Angle * 2.0 * M_PI;
303 float CosOfAngle = fabs(cos(Angle));
304 float SinOfAngle = fabs(sin(Angle));
306 float Pad = std::max(CosOfAngle * Length, SinOfAngle * OrthogonalPad);
307 BoundingBox->
MinX = Proto->
X - Pad;
308 BoundingBox->
MaxX = Proto->
X + Pad;
310 Pad = std::max(SinOfAngle * Length, CosOfAngle * OrthogonalPad);
311 BoundingBox->
MinY = Proto->
Y - Pad;
312 BoundingBox->
MaxY = Proto->
Y + Pad;
324 return (X >= Rectangle->
MinX) &&
325 (X <= Rectangle->
MaxX) &&
326 (Y >= Rectangle->
MinY) &&
327 (Y <= Rectangle->
MaxY);
void ComputeMergedProto(PROTO p1, PROTO p2, float w1, float w2, PROTO MergedProto)
#define MAX_LENGTH_MISMATCH
void FreeFeature(FEATURE Feature)
#define WORST_MATCH_ALLOWED
double training_angle_match_scale
#define double_VAR(name, val, comment)
double training_tangent_bbox_pad
double training_angle_pad
double training_similarity_midpoint
#define ProtoIn(Class, Pid)
double training_similarity_curl
#define GetPicoFeatureLength()
double EvidenceOf(double Similarity)
void ComputePaddedBoundingBox(PROTO Proto, float TangentPad, float OrthogonalPad, FRECT *BoundingBox)
void MakeNewFromOld(PROTO New, PROTOTYPE *Old)
bool PointInside(FRECT *Rectangle, float X, float Y)
float CompareProtos(PROTO p1, PROTO p2)
FEATURE NewFeature(const FEATURE_DESC_STRUCT *FeatureDesc)
void FillABC(PROTO Proto)
float SubfeatureEvidence(FEATURE Feature, PROTO Proto)
TESS_API const FEATURE_DESC_STRUCT PicoFeatDesc
double training_orthogonal_bbox_pad
bool DummyFastMatch(FEATURE Feature, PROTO Proto)
int FindClosestExistingProto(CLASS_TYPE Class, int NumMerged[], PROTOTYPE *Prototype)