#include "outfeat.h"
#include "classify.h"
#include "featdefs.h"
#include "mfoutline.h"
#include "ocrfeatures.h"
#include <cstdio>
Go to the source code of this file.
◆ AddOutlineFeatureToSet()
This routine computes the midpoint between Start and End to obtain the x,y position of the outline-feature. It also computes the direction from Start to End as the direction of the outline-feature and the distance from Start to End as the length of the outline-feature. This feature is then inserted into the next feature slot in FeatureSet.
- Parameters
-
Start | starting point of outline-feature |
End | ending point of outline-feature |
FeatureSet | set to add outline-feature to |
Definition at line 83 of file outfeat.cpp.
85 {
87
94
95}
const FEATURE_DESC_STRUCT OutlineFeatDesc
float DistanceBetween(FPOINT A, FPOINT B)
float NormalizedAngleFrom(FPOINT *Point1, FPOINT *Point2, float FullScale)
FEATURE NewFeature(const FEATURE_DESC_STRUCT *FeatureDesc)
bool AddFeature(FEATURE_SET FeatureSet, FEATURE Feature)
◆ ConvertToOutlineFeatures()
This routine steps converts each section in the specified outline to a feature described by its x,y position, length and angle. Results are returned in FeatureSet.
- Parameters
-
Outline | outline to extract outline-features from |
FeatureSet | set of features to add outline-features to |
Definition at line 107 of file outfeat.cpp.
107 {
112
113 if (DegenerateOutline (Outline))
114 return;
115
116 First = Outline;
117 Next = First;
118 do {
119 FeatureStart = PointAt(Next)->Point;
120 Next = NextPointAfter(Next);
121
122
123
124
125
126
127 if (!PointAt(Next)->Hidden) {
128 FeatureEnd = PointAt(Next)->Point;
130 }
131 }
132 while (Next != First);
133}
void AddOutlineFeatureToSet(FPOINT *Start, FPOINT *End, FEATURE_SET FeatureSet)
◆ NormalizeOutlineX()
This routine computes the weighted average x position over all of the outline-features in FeatureSet and then renormalizes the outline-features to force this average to be the x origin (i.e. x=0). FeatureSet is changed.
- Parameters
-
FeatureSet | outline-features to be normalized |
Definition at line 145 of file outfeat.cpp.
145 {
146 int i;
148 float Length;
149 float TotalX = 0.0;
150 float TotalWeight = 0.0;
151 float Origin;
152
154 return;
155
160 TotalWeight += Length;
161 }
162 Origin = TotalX / TotalWeight;
163
167 }
168}