~vcs-imports/tesseract-ocr/trunk

« back to all changes in this revision

Viewing changes to classify/intmatcher.cpp

  • Committer: theraysmith at gmail
  • Date: 2013-11-08 20:30:56 UTC
  • Revision ID: svn-v4:d0cd1f9f-072b-0410-8dd7-cf729c803f20:trunk:904
Refactorerd control functions to enable parallel blob classification

Show diffs side-by-side

added added

removed removed

Lines of Context:
693
693
 
694
694
 
695
695
/*---------------------------------------------------------------------------*/
696
 
void IntegerMatcher::Init(tesseract::IntParam *classify_debug_level,
697
 
                          int classify_integer_matcher_multiplier) {
 
696
void IntegerMatcher::Init(tesseract::IntParam *classify_debug_level) {
698
697
  classify_debug_level_ = classify_debug_level;
699
698
 
700
 
  /* Set default mode of operation of IntegerMatcher */
701
 
  SetCharNormMatch(classify_integer_matcher_multiplier);
702
 
 
703
699
  /* Initialize table for evidence to similarity lookup */
704
700
  for (int i = 0; i < SE_TABLE_SIZE; i++) {
705
701
    uinT32 IntSimilarity = i << (27 - SE_TABLE_BITS);
724
720
  evidence_mult_mask_ = ((1 << kIntEvidenceTruncBits) - 1);
725
721
}
726
722
 
727
 
/*--------------------------------------------------------------------------*/
728
 
void IntegerMatcher::SetBaseLineMatch() {
729
 
  local_matcher_multiplier_ = 0;
730
 
}
731
 
 
732
 
 
733
 
/*--------------------------------------------------------------------------*/
734
 
void IntegerMatcher::SetCharNormMatch(int integer_matcher_multiplier) {
735
 
  local_matcher_multiplier_ = integer_matcher_multiplier;
736
 
}
737
 
 
738
723
 
739
724
/**----------------------------------------------------------------------------
740
725
              Private Code
1283
1268
// Applies the CN normalization factor to the given rating and returns
1284
1269
// the modified rating.
1285
1270
float IntegerMatcher::ApplyCNCorrection(float rating, int blob_length,
1286
 
                                        int normalization_factor) {
 
1271
                                        int normalization_factor,
 
1272
                                        int matcher_multiplier) {
1287
1273
  return (rating * blob_length +
1288
 
    local_matcher_multiplier_ * normalization_factor / 256.0) /
1289
 
    (blob_length + local_matcher_multiplier_);
 
1274
          matcher_multiplier * normalization_factor / 256.0) /
 
1275
      (blob_length + matcher_multiplier);
1290
1276
}
1291
1277
 
1292
1278
/*---------------------------------------------------------------------------*/