MCPcopy Create free account
hub / github.com/creatale/node-dv / ExtractMicroFeature

Function ExtractMicroFeature

deps/tesseract/classify/mfx.cpp:183–199  ·  view source on GitHub ↗

* This routine computes the feature parameters which describe * the micro-feature that starts and Start and ends at End. * A new micro-feature is allocated, filled with the feature * parameters, and returned. The routine assumes that * Start and End are not the same point. If they are the * same point, NULL is returned, a warning message is * printed, and the current outline is dumped to s

Source from the content-addressed store, hash-verified

181 * - 11/17/89, DSJ, Added handling for Start and End same point.
182 */
183MICROFEATURE ExtractMicroFeature(MFOUTLINE Start, MFOUTLINE End) {
184 MICROFEATURE NewFeature;
185 MFEDGEPT *P1, *P2;
186
187 P1 = PointAt(Start);
188 P2 = PointAt(End);
189
190 NewFeature = NewMicroFeature ();
191 NewFeature[XPOSITION] = AverageOf(P1->Point.x, P2->Point.x);
192 NewFeature[YPOSITION] = AverageOf(P1->Point.y, P2->Point.y);
193 NewFeature[MFLENGTH] = DistanceBetween(P1->Point, P2->Point);
194 NewFeature[ORIENTATION] = NormalizedAngleFrom(&P1->Point, &P2->Point, 1.0);
195 NewFeature[FIRSTBULGE] = 0.0f; // deprecated
196 NewFeature[SECONDBULGE] = 0.0f; // deprecated
197
198 return NewFeature;
199} /* ExtractMicroFeature */

Callers 1

ConvertToMicroFeaturesFunction · 0.85

Calls 3

NewMicroFeatureFunction · 0.85
DistanceBetweenFunction · 0.85
NormalizedAngleFromFunction · 0.85

Tested by

no test coverage detected