classify/speckle.cpp File Reference

#include "speckle.h"
#include "debug.h"
#include "blobs.h"

Go to the source code of this file.

Functions


Function Documentation

LIST AddLargeSpeckleTo ( LIST  Choices  ) 

Adds a null choice to Choices with a rating equal to the worst rating in Choices, plus a pad.

Parameters:
Choices Choices to add a speckle choice to
Note:
Globals:
  • SmallSpecklePenalty Rating for a small speckle
  • LargeSpecklePenalty Rating penalty for a large speckle
  • SmallSpeckleCertainty Certainty for a small speckle
Returns:
LIST of new choices, null choice added to end.
The certainty of the new choice is the same as the certainty of the worst choice in Choices. The new choice is added to the end of Choices.
Note:
Exceptions: none
Date:
Mon Mar 11 11:08:11 1991, DSJ, Created.

Definition at line 80 of file speckle.cpp.

References append_choice(), best_certainty, best_probability, last(), NIL, SmallSpeckleCertainty, and SmallSpecklePenalty.

Referenced by AdaptiveClassifier().

00080                                      { 
00081   LIST WorstChoice;
00082 
00083   /* if there are no other choices, use the small speckle penalty plus
00084      the large speckle penalty */
00085   if (Choices == NIL)
00086     return (append_choice (NIL, "", SmallSpecklePenalty + LargeSpecklePenalty,
00087       SmallSpeckleCertainty, -1));
00088 
00089   /* if there are other choices,  add a null choice that is slightly worse
00090      than the worst choice so far */
00091   WorstChoice = last (Choices);
00092   return (append_choice (Choices, "",
00093     best_probability (WorstChoice) + LargeSpecklePenalty,
00094     best_certainty (WorstChoice), -1));
00095 
00096 }                                /* AddLargeSpeckleTo */

void InitSpeckleVars (  ) 

Install the control variables needed for the speckle filters.

Parameters:
none 
Returns:
none
Note:
Exceptions: none
Date:
Mon Mar 11 12:04:59 1991, DSJ, Created.

Definition at line 108 of file speckle.cpp.

References cprintf().

Referenced by init_dj_debug().

00108                        { 
00109   MakeMaxLargeSpeckleSize(); 
00110   MakeSmallSpecklePenalty(); 
00111   MakeLargeSpecklePenalty(); 
00112   MakeSmallSpeckleCertainty(); 
00113 #ifdef TEXT_VERBOSE
00114   // gets a 'k', see ccmain/tesseractmain.dox
00115   cprintf("k");
00116 #endif
00117 }                                /* InitSpeckleVars */

BOOL8 LargeSpeckle ( TBLOB Blob,
TEXTROW Row 
)

Decides if both the width of height of Blob are less than the MaxLargeSpeckleSize.

Parameters:
Blob Blob to test against speckle criteria
Row Text row that blob is in
Note:
Globals: MaxLargeSpeckleSize largest allowed speckle
Returns:
TRUE if Blob is speckle, FALSE otherwise.
Note:
Exceptions: none
Date:
Mon Mar 11 10:06:49 1991, DSJ, Created.

Definition at line 132 of file speckle.cpp.

References blob_bounding_box(), FALSE, RowHeight, TRUE, TPOINT::x, and TPOINT::y.

Referenced by AdaptiveClassifier().

00132                                               { 
00133   FLOAT32 SpeckleSize;
00134   TPOINT TopLeft;
00135   TPOINT BottomRight;
00136 
00137   SpeckleSize = RowHeight (Row) * MaxLargeSpeckleSize;
00138   blob_bounding_box(Blob, &TopLeft, &BottomRight); 
00139 
00140   if (TopLeft.y - BottomRight.y < SpeckleSize &&
00141     BottomRight.x - TopLeft.x < SpeckleSize)
00142     return (TRUE);
00143   else
00144     return (FALSE);
00145 }                                /* LargeSpeckle */


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