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

Function ValidCharDescription

deps/tesseract/classify/featdefs.cpp:219–239  ·  view source on GitHub ↗

Return whether all of the fields of the given feature set are well defined (not inf or nan).

Source from the content-addressed store, hash-verified

217// Return whether all of the fields of the given feature set
218// are well defined (not inf or nan).
219bool ValidCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs,
220 CHAR_DESC CharDesc) {
221 bool anything_written = false;
222 bool well_formed = true;
223 for (int Type = 0; Type < CharDesc->NumFeatureSets; Type++) {
224 if (CharDesc->FeatureSets[Type]) {
225 for (int i = 0; i < CharDesc->FeatureSets[Type]->NumFeatures; i++) {
226 FEATURE feat = CharDesc->FeatureSets[Type]->Features[i];
227 for (int p = 0; p < feat->Type->NumParams; p++) {
228 if (isnan(feat->Params[p]) || isinf(feat->Params[p]))
229 well_formed = false;
230 else
231 anything_written = true;
232 }
233 }
234 } else {
235 return false;
236 }
237 }
238 return anything_written && well_formed;
239} /* ValidCharDescription */
240
241/*---------------------------------------------------------------------------*/
242/**

Callers 1

LearnBlobMethod · 0.85

Calls 1

isnanFunction · 0.85

Tested by

no test coverage detected