Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
speckle.h File Reference
#include "baseline.h"
#include "ratngs.h"

Go to the source code of this file.

Functions

void AddLargeSpeckleTo (BLOB_CHOICE_LIST *Choices)
 
BOOL8 LargeSpeckle (TBLOB *Blob)
 

Function Documentation

void AddLargeSpeckleTo ( BLOB_CHOICE_LIST *  Choices)

This routine adds a null choice to Choices with a rating equal to the worst rating in Choices plus a pad. 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.

Globals:

Parameters
Choiceschoices to add a speckle choice to
Returns
New Choices list with null choice added to end.

Exceptions: none History: Mon Mar 11 11:08:11 1991, DSJ, Created.

Definition at line 62 of file speckle.cpp.

62  {
63  assert(Choices != NULL);
64  BLOB_CHOICE *blob_choice;
65  BLOB_CHOICE_IT temp_it;
66  temp_it.set_to_list(Choices);
67 
68  // If there are no other choices, use the small speckle penalty plus
69  // the large speckle penalty.
70  if (Choices->length() == 0) {
71  blob_choice =
73  speckle_small_certainty, -1, -1, NULL, 0, 0, false);
74  temp_it.add_to_end(blob_choice);
75  return;
76  }
77 
78  // If there are other choices, add a null choice that is slightly worse
79  // than the worst choice so far.
80  temp_it.move_to_last();
81  blob_choice = temp_it.data(); // pick the worst choice
82  temp_it.add_to_end(
83  new BLOB_CHOICE(0, blob_choice->rating() + speckle_large_penalty,
84  blob_choice->certainty(), -1, -1, NULL, 0, 0, false));
85 } /* AddLargeSpeckleTo */
#define NULL
Definition: host.h:144
float certainty() const
Definition: ratngs.h:65
double speckle_small_certainty
Definition: speckle.cpp:37
double speckle_large_penalty
Definition: speckle.cpp:35
float rating() const
Definition: ratngs.h:62
BOOL8 LargeSpeckle ( TBLOB blob)

This routine returns TRUE if both the width of height of Blob are less than the MaxLargeSpeckleSize.

Globals:

Exceptions: none History: Mon Mar 11 10:06:49 1991, DSJ, Created.

Parameters
blobblob to test against speckle criteria
Returns
TRUE if blob is speckle, FALSE otherwise.

Definition at line 103 of file speckle.cpp.

103  {
104  double speckle_size = BASELINE_SCALE * speckle_large_max_size;
105  TBOX bbox = blob->bounding_box();
106  return (bbox.width() < speckle_size && bbox.height() < speckle_size);
107 } /* LargeSpeckle */
inT16 width() const
Definition: rect.h:104
Definition: rect.h:29
double speckle_large_max_size
Definition: speckle.cpp:31
TBOX bounding_box() const
Definition: blobs.cpp:384
#define BASELINE_SCALE
Definition: baseline.h:39
inT16 height() const
Definition: rect.h:97