87 if (Length < 0) Length = 0;
94 if (Evidence < WorstEvidence)
95 WorstEvidence = Evidence;
106 if (Evidence < WorstEvidence)
107 WorstEvidence = Evidence;
114 return (WorstEvidence);
140 TotalWeight = w1 + w2;
144 MergedProto->
X = p1->
X * w1 + p2->
X * w2;
145 MergedProto->
Y = p1->
Y * w1 + p2->
Y * w2;
175 FLOAT32 Match, OldMatch, NewMatch;
181 for (Pid = 0; Pid < Class->
NumProtos; Pid++) {
184 (
FLOAT32) NumMerged[Pid], 1.0, &MergedProto);
187 Match =
MIN(OldMatch, NewMatch);
188 if (Match > BestMatch) {
228 if (Dangle < -0.5) Dangle += 1.0;
229 if (Dangle > 0.5) Dangle -= 1.0;
236 return (
EvidenceOf (Distance * Distance + Dangle * Dangle));
252 Similarity = Similarity * Similarity * Similarity;
254 Similarity = Similarity * Similarity;
258 return (1.0 / (1.0 + Similarity));
286 if (AngleError > 0.5)
287 AngleError = 1.0 - AngleError;
289 if (AngleError > MaxAngleError)
321 FLOAT32 CosOfAngle, SinOfAngle;
323 Length = Proto->
Length / 2.0 + TangentPad;
324 Angle = Proto->
Angle * 2.0 *
PI;
325 CosOfAngle = fabs(cos(Angle));
326 SinOfAngle = fabs(sin(Angle));
328 Pad =
MAX (CosOfAngle * Length, SinOfAngle * OrthogonalPad);
329 BoundingBox->
MinX = Proto->
X - Pad;
330 BoundingBox->
MaxX = Proto->
X + Pad;
332 Pad =
MAX(SinOfAngle * Length, CosOfAngle * OrthogonalPad);
333 BoundingBox->
MinY = Proto->
Y - Pad;
334 BoundingBox->
MaxY = Proto->
Y + Pad;
348 if (X < Rectangle->MinX)
return (
FALSE);
350 if (Y < Rectangle->MinY)
return (
FALSE);
#define MAX_LENGTH_MISMATCH
void ComputeMergedProto(PROTO p1, PROTO p2, FLOAT32 w1, FLOAT32 w2, PROTO MergedProto)
#define WORST_MATCH_ALLOWED
#define double_VAR(name, val, comment)
#define ProtoIn(Class, Pid)
FLOAT32 SubfeatureEvidence(FEATURE Feature, PROTO Proto)
FEATURE NewFeature(const FEATURE_DESC_STRUCT *FeatureDesc)
double training_angle_pad
double training_tangent_bbox_pad
const FEATURE_DESC_STRUCT PicoFeatDesc
int FindClosestExistingProto(CLASS_TYPE Class, int NumMerged[], PROTOTYPE *Prototype)
#define GetPicoFeatureLength()
BOOL8 PointInside(FRECT *Rectangle, FLOAT32 X, FLOAT32 Y)
double training_angle_match_scale
double EvidenceOf(double Similarity)
double training_orthogonal_bbox_pad
void FillABC(PROTO Proto)
void FreeFeature(FEATURE Feature)
FLOAT32 CompareProtos(PROTO p1, PROTO p2)
double training_similarity_midpoint
double training_similarity_curl
void ComputePaddedBoundingBox(PROTO Proto, FLOAT32 TangentPad, FLOAT32 OrthogonalPad, FRECT *BoundingBox)
BOOL8 DummyFastMatch(FEATURE Feature, PROTO Proto)
void MakeNewFromOld(PROTO New, PROTOTYPE *Old)