Tesseract  3.02
tesseract-ocr/classify/speckle.cpp File Reference
#include "speckle.h"
#include "blobs.h"
#include "ratngs.h"
#include "params.h"

Go to the source code of this file.


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


double speckle_large_max_size = 0.30
double speckle_small_penalty = 10.0
double speckle_large_penalty = 10.0
double speckle_small_certainty = -1.0

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.


Choiceschoices to add a speckle choice to
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.

  assert(Choices != NULL);
  BLOB_CHOICE *blob_choice;
  BLOB_CHOICE_IT temp_it;

  // If there are no other choices, use the small speckle penalty plus
  // the large speckle penalty.
  if (Choices->length() == 0) {
    blob_choice =
      new BLOB_CHOICE(0, speckle_small_certainty + speckle_large_penalty,
                      speckle_small_certainty, -1, -1, NULL, 0, 0, false);

  // If there are other choices,  add a null choice that is slightly worse
  // than the worst choice so far.
  blob_choice = temp_it.data();  // pick the worst choice
      new BLOB_CHOICE(0, blob_choice->rating() + speckle_large_penalty,
                      blob_choice->certainty(), -1, -1, NULL, 0, 0, false));
}                                /* AddLargeSpeckleTo */
BOOL8 LargeSpeckle ( TBLOB blob)

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


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

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

Definition at line 103 of file speckle.cpp.

  double speckle_size = BASELINE_SCALE * speckle_large_max_size;
  TBOX bbox = blob->bounding_box();
  return (bbox.width() < speckle_size && bbox.height() < speckle_size);
}                                /* LargeSpeckle */

Variable Documentation

double speckle_large_max_size = 0.30

define control knobs for adjusting definition of speckle "Max large speckle size"

Definition at line 31 of file speckle.cpp.

double speckle_large_penalty = 10.0

"Large speckle penalty"

Definition at line 35 of file speckle.cpp.

double speckle_small_certainty = -1.0

"Small speckle certainty"

Definition at line 37 of file speckle.cpp.

double speckle_small_penalty = 10.0

"Small speckle penalty"

Definition at line 33 of file speckle.cpp.