Gets the canonical sample for the given font, class pair. ComputeCanonicalSamples must have been called first.
| 460 | // Gets the canonical sample for the given font, class pair. |
| 461 | // ComputeCanonicalSamples must have been called first. |
| 462 | const 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. |
no test coverage detected