ccmain/blobcmp.h File Reference

#include "tstruct.h"

Go to the source code of this file.

Functions


Function Documentation

float compare_tess_blobs ( TBLOB blob1,
TEXTROW row1,
TBLOB blob2,
TEXTROW row2 
)

Match 2 blobs using the adaptive classifier.

Not called during normal recognition in v1.02

Definition at line 36 of file blobcmp.cpp.

References AllConfigsOn, AllProtosOn, ClassForClassId, CMP_CLASS, EnterClassifyMode, free_adapted_templates(), FreeBitVector(), FreeFeatureSet(), GetAdaptiveFeatures(), GetLineStatsFromRow(), IntegerMatcher(), MakeNewAdaptedClass(), MAX_FLOAT32, MAX_NUM_CONFIGS, MAX_NUM_PROTOS, NewAdaptedTemplates(), NewBitVector(), INT_RESULT_STRUCT::Rating, set_all_bits, SetBaseLineMatch(), ADAPT_TEMPLATES_STRUCT::Templates, and WordsInVectorOfSize.

Referenced by compare_bln_blobs().

00039                                         {
00040   int fcount;                    /*number of features */
00041   ADAPT_TEMPLATES ad_templates;
00042   LINE_STATS line_stats1, line_stats2;
00043   INT_FEATURE_ARRAY int_features;
00044   FEATURE_SET float_features;
00045   INT_RESULT_STRUCT int_result;  /*output */
00046 
00047   BIT_VECTOR AllProtosOn = NewBitVector (MAX_NUM_PROTOS);
00048   BIT_VECTOR AllConfigsOn = NewBitVector (MAX_NUM_CONFIGS);
00049   set_all_bits (AllProtosOn, WordsInVectorOfSize (MAX_NUM_PROTOS));
00050   set_all_bits (AllConfigsOn, WordsInVectorOfSize (MAX_NUM_CONFIGS));
00051 
00052   EnterClassifyMode;
00053   ad_templates = NewAdaptedTemplates ();
00054   GetLineStatsFromRow(row1, &line_stats1);
00055                                  /*copy baseline stuff */
00056   GetLineStatsFromRow(row2, &line_stats2);
00057   MakeNewAdaptedClass(blob1, &line_stats1, CMP_CLASS, ad_templates);
00058   fcount = GetAdaptiveFeatures (blob2, &line_stats2,
00059     int_features, &float_features);
00060   if (fcount > 0) {
00061     SetBaseLineMatch();
00062     IntegerMatcher (ClassForClassId (ad_templates->Templates, CMP_CLASS),
00063       AllProtosOn, AllConfigsOn, fcount, fcount,
00064       int_features, 0, 0, &int_result, testedit_match_debug);
00065     FreeFeatureSet(float_features);
00066     if (int_result.Rating < 0)
00067       int_result.Rating = MAX_FLOAT32;
00068   }
00069 
00070   free_adapted_templates(ad_templates);
00071   FreeBitVector(AllConfigsOn);
00072   FreeBitVector(AllProtosOn);
00073 
00074   return fcount > 0 ? int_result.Rating * fcount : MAX_FLOAT32;
00075 }


Generated on Wed Feb 28 19:49:13 2007 for Tesseract by  doxygen 1.5.1