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

Method GetCanonicalSample

deps/tesseract/classify/trainingsampleset.cpp:462–470  ·  view source on GitHub ↗

Gets the canonical sample for the given font, class pair. ComputeCanonicalSamples must have been called first.

Source from the content-addressed store, hash-verified

460// Gets the canonical sample for the given font, class pair.
461// ComputeCanonicalSamples must have been called first.
462const TrainingSample* TrainingSampleSet::GetCanonicalSample(
463 int font_id, int class_id) const {
464 ASSERT_HOST(font_class_array_ != NULL);
465 int font_index = font_id_map_.SparseToCompact(font_id);
466 if (font_index < 0) return NULL;
467 int sample_index = (*font_class_array_)(font_index,
468 class_id).canonical_sample;
469 return sample_index >= 0 ? samples_[sample_index] : NULL;
470}
471
472// Gets the max distance for the given canonical sample.
473// ComputeCanonicalSamples must have been called first.

Callers 1

DisplaySamplesMethod · 0.80

Calls 1

SparseToCompactMethod · 0.45

Tested by

no test coverage detected