* FindBadFeatures finds all features with maximum feature-evidence < * AdaptFeatureThresh. The list is ordered by increasing feature number. * @param ClassTemplate Prototypes & tables for a class * @param ProtoMask AND Mask for proto word * @param ConfigMask AND Mask for config word * @param BlobLength Length of unormalized blob * @param NumFeatures Number of features in blob * @param Featu
| 625 | * @note History: Tue Mar 12 17:09:26 MST 1991, RWM, Created |
| 626 | */ |
| 627 | int IntegerMatcher::FindBadFeatures( |
| 628 | INT_CLASS ClassTemplate, |
| 629 | BIT_VECTOR ProtoMask, |
| 630 | BIT_VECTOR ConfigMask, |
| 631 | uinT16 BlobLength, |
| 632 | inT16 NumFeatures, |
| 633 | INT_FEATURE_ARRAY Features, |
| 634 | FEATURE_ID *FeatureArray, |
| 635 | int AdaptFeatureThreshold, |
| 636 | int Debug) { |
| 637 | ScratchEvidence *tables = new ScratchEvidence(); |
| 638 | int NumBadFeatures = 0; |
| 639 | |
| 640 | /* DEBUG opening heading */ |
| 641 | if (MatchDebuggingOn(Debug)) |
| 642 | cprintf("Find Bad Features -------------------------------------------\n"); |
| 643 | |
| 644 | tables->Clear(ClassTemplate); |
| 645 | |
| 646 | for (int Feature = 0; Feature < NumFeatures; Feature++) { |
| 647 | UpdateTablesForFeature( |
| 648 | ClassTemplate, ProtoMask, ConfigMask, Feature, &Features[Feature], |
| 649 | tables, Debug); |
| 650 | |
| 651 | /* Find Best Evidence for Current Feature */ |
| 652 | int best = 0; |
| 653 | for (int i = 0; i < ClassTemplate->NumConfigs; i++) |
| 654 | if (tables->feature_evidence_[i] > best) |
| 655 | best = tables->feature_evidence_[i]; |
| 656 | |
| 657 | /* Find Bad Features */ |
| 658 | if (best < AdaptFeatureThreshold) { |
| 659 | *FeatureArray = Feature; |
| 660 | FeatureArray++; |
| 661 | NumBadFeatures++; |
| 662 | } |
| 663 | } |
| 664 | |
| 665 | #ifndef GRAPHICS_DISABLED |
| 666 | if (PrintProtoMatchesOn(Debug) || PrintMatchSummaryOn(Debug)) |
| 667 | DebugFeatureProtoError(ClassTemplate, ProtoMask, ConfigMask, *tables, |
| 668 | NumFeatures, Debug); |
| 669 | #endif |
| 670 | |
| 671 | if (MatchDebuggingOn(Debug)) |
| 672 | cprintf("Match Complete --------------------------------------------\n"); |
| 673 | |
| 674 | delete tables; |
| 675 | return NumBadFeatures; |
| 676 | } |
| 677 | |
| 678 | |
| 679 | void IntegerMatcher::Init(tesseract::IntParam *classify_debug_level) { |
no test coverage detected