ccmain/paircmp.cpp File Reference

#include "mfcpch.h"
#include "blobcmp.h"
#include "tfacep.h"
#include "paircmp.h"

Go to the source code of this file.

Defines

Functions


Define Documentation

#define EXTERN

Note:
File: paircmp.cpp (Formerly paircmp.c)
Code to compare two blobs using the adaptive matcher
Author:
Ray Smith
Date:
Wed Apr 21 09:31:02 BST 1993
 * (C) Copyright 1993, Hewlett-Packard Ltd.
 ** Licensed under the Apache License, Version 2.0 (the "License");
 ** you may not use this file except in compliance with the License.
 ** You may obtain a copy of the License at
 ** http://www.apache.org/licenses/LICENSE-2.0
 ** Unless required by applicable law or agreed to in writing, software
 ** distributed under the License is distributed on an "AS IS" BASIS,
 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 ** See the License for the specific language governing permissions and
 ** limitations under the License.

Definition at line 25 of file paircmp.cpp.


Function Documentation

float compare_bln_blobs ( PBLOB blob1,
DENORM denorm1,
PBLOB blob2,
DENORM denorm2 
)

Compare 2 baseline normalised blobs and return the rating.

Definition at line 79 of file paircmp.cpp.

References compare_tess_blobs(), free_blob(), make_tess_blob(), make_tess_row(), and TRUE.

Referenced by compare_blobs(), and CHAR_SAMPLE::match_sample().

00083                                          {
00084   TBLOB *tblob1;                 //tessblobs
00085   TBLOB *tblob2;
00086   TEXTROW tessrow1, tessrow2;    //tess rows
00087   float rating;                  //match result
00088 
00089   tblob1 = make_tess_blob (blob1, TRUE);
00090   make_tess_row(denorm1, &tessrow1); 
00091   tblob2 = make_tess_blob (blob2, TRUE);
00092   make_tess_row(denorm2, &tessrow2); 
00093   rating = compare_tess_blobs (tblob1, &tessrow1, tblob2, &tessrow2);
00094   free_blob(tblob1); 
00095   free_blob(tblob2); 
00096 
00097   return rating;
00098 }

BOOL8 compare_blob_pairs ( BLOCK ,
ROW row,
WERD ,
PBLOB blob 
)

A blob processor to compare pairs of selected blobs.

Definition at line 30 of file paircmp.cpp.

References compare_blobs(), NULL, tprintf(), and TRUE.

00035                           {
00036   static ROW *prev_row = NULL;   //other in pair
00037   static PBLOB *prev_blob = NULL;
00038   float rating;                  //from matcher
00039 
00040   if (prev_row == NULL || prev_blob == NULL) {
00041     prev_row = row;
00042     prev_blob = blob;
00043   }
00044   else {
00045     rating = compare_blobs (prev_blob, prev_row, blob, row);
00046     tprintf ("Rating=%g\n", rating);
00047     prev_row = NULL;
00048     prev_blob = NULL;
00049   }
00050   return TRUE;
00051 }

float compare_blobs ( PBLOB blob1,
ROW row1,
PBLOB blob2,
ROW row2 
)

Compare 2 blobs and return the rating.

Definition at line 57 of file paircmp.cpp.

References PBLOB::baseline_normalise(), and compare_bln_blobs().

Referenced by compare_blob_pairs(), and find_repeated_chars().

00061                                {
00062   PBLOB *bn_blob1;               //baseline norm
00063   PBLOB *bn_blob2;
00064   DENORM denorm1, denorm2;
00065   float rating;                  //match result
00066 
00067   bn_blob1 = blob1->baseline_normalise (row1, &denorm1);
00068   bn_blob2 = blob2->baseline_normalise (row2, &denorm2);
00069   rating = compare_bln_blobs (bn_blob1, &denorm1, bn_blob2, &denorm2);
00070   delete bn_blob1;
00071   delete bn_blob2;
00072   return rating;
00073 }


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