Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Namespaces | Enumerations | Functions | Variables
blobbox.h File Reference
`#include "clst.h"`
`#include "elst2.h"`
`#include "werd.h"`
`#include "ocrblock.h"`
`#include "statistc.h"`

Go to the source code of this file.

## Classes

class | BLOBNBOX
class | TO_ROW
class | TO_BLOCK

## Namespaces

namespace | tesseract

## Enumerations

enum | PITCH_TYPE { PITCH_DUNNO, PITCH_DEF_FIXED, PITCH_MAYBE_FIXED, PITCH_DEF_PROP, PITCH_MAYBE_PROP, PITCH_CORR_FIXED, PITCH_CORR_PROP }
enum | TabType { TT_NONE, TT_DELETED, TT_MAYBE_RAGGED, TT_MAYBE_ALIGNED, TT_CONFIRMED, TT_VLINE }
enum | BlobRegionType { BRT_NOISE, BRT_HLINE, BRT_VLINE, BRT_RECTIMAGE, BRT_POLYIMAGE, BRT_UNKNOWN, BRT_VERT_TEXT, BRT_TEXT, BRT_COUNT }
enum | BlobNeighbourDir { BND_LEFT, BND_BELOW, BND_RIGHT, BND_ABOVE, BND_COUNT }
enum | BlobSpecialTextType { BSTT_NONE, BSTT_ITALIC, BSTT_DIGIT, BSTT_MATH, BSTT_UNCLEAR, BSTT_SKIP, BSTT_COUNT }
enum | BlobTextFlowType { BTFT_NONE, BTFT_NONTEXT, BTFT_NEIGHBOURS, BTFT_CHAIN, BTFT_STRONG_CHAIN, BTFT_TEXT_ON_IMAGE, BTFT_LEADER, BTFT_COUNT }

## Functions

BlobNeighbourDir | DirOtherWay (BlobNeighbourDir dir)
bool | DominatesInMerge (BlobTextFlowType type1, BlobTextFlowType type2)
void | find_cblob_limits (C_BLOB *blob, float leftx, float rightx, FCOORD rotation, float &ymin, float &ymax)
void | find_cblob_vlimits (C_BLOB *blob, float leftx, float rightx, float &ymin, float &ymax)
void | find_cblob_hlimits (C_BLOB *blob, float bottomy, float topy, float &xmin, float &xymax)
C_BLOB * | crotate_cblob (C_BLOB *blob, FCOORD rotation)
TBOX | box_next (BLOBNBOX_IT *it)
TBOX | box_next_pre_chopped (BLOBNBOX_IT *it)
void | vertical_cblob_projection (C_BLOB *blob, STATS *stats)
void | vertical_coutline_projection (C_OUTLINE *outline, STATS *stats)
void | plot_blob_list (ScrollView *win, BLOBNBOX_LIST *list, ScrollView::Color body_colour, ScrollView::Color child_colour)

## Variables

double | textord_error_weight = 3

## Enumeration Type Documentation

enum BlobNeighbourDir

Enumerator:

  BND_LEFT |
  BND_BELOW |
  BND_RIGHT |
  BND_ABOVE |
  BND_COUNT |

Definition at line 72 of file blobbox.h.

{
BND_LEFT,
BND_BELOW,
BND_RIGHT,
BND_ABOVE,
BND_COUNT
};

enum BlobRegionType

Enumerator:

  BRT_NOISE |
  BRT_HLINE |
  BRT_VLINE |
  BRT_RECTIMAGE |
  BRT_POLYIMAGE |
  BRT_UNKNOWN |
  BRT_VERT_TEXT |
  BRT_TEXT |
  BRT_COUNT |

Definition at line 57 of file blobbox.h.

{
BRT_NOISE, // Neither text nor image.
BRT_HLINE, // Horizontal separator line.
BRT_VLINE, // Vertical separator line.
BRT_RECTIMAGE, // Rectangular image.
BRT_POLYIMAGE, // Non-rectangular image.
BRT_UNKNOWN, // Not determined yet.
BRT_VERT_TEXT, // Vertical alignment, not necessarily vertically oriented.
BRT_TEXT, // Convincing text.
BRT_COUNT // Number of possibilities.
};

enum BlobSpecialTextType

Enumerator:

  BSTT_NONE |
  BSTT_ITALIC |
  BSTT_DIGIT |
  BSTT_MATH |
  BSTT_UNCLEAR |
  BSTT_SKIP |
  BSTT_COUNT |

Definition at line 81 of file blobbox.h.

{
BSTT_NONE, // No special.
BSTT_ITALIC, // Italic style.
BSTT_DIGIT, // Digit symbols.
BSTT_MATH, // Mathmatical symobls (not including digit).
BSTT_UNCLEAR, // Characters with low recognition rate.
BSTT_SKIP, // Characters that we skip labeling (usually too small).
BSTT_COUNT
};

enum BlobTextFlowType

Enumerator:

  BTFT_NONE |
  BTFT_NONTEXT |
  BTFT_NEIGHBOURS |
  BTFT_CHAIN |
  BTFT_STRONG_CHAIN |
  BTFT_TEXT_ON_IMAGE |
  BTFT_LEADER |
  BTFT_COUNT |

Definition at line 99 of file blobbox.h.

{
BTFT_NONE, // No text flow set yet.
BTFT_NONTEXT, // Flow too poor to be likely text.
BTFT_NEIGHBOURS, // Neighbours support flow in this direction.
BTFT_CHAIN, // There is a weak chain of text in this direction.
BTFT_STRONG_CHAIN, // There is a strong chain of text in this direction.
BTFT_TEXT_ON_IMAGE, // There is a strong chain of text on an image.
BTFT_LEADER, // Leader dots/dashes etc.
BTFT_COUNT
};

enum PITCH_TYPE

Enumerator:

  PITCH_DUNNO |
  PITCH_DEF_FIXED |
  PITCH_MAYBE_FIXED |
  PITCH_DEF_PROP |
  PITCH_MAYBE_PROP |
  PITCH_CORR_FIXED |
  PITCH_CORR_PROP |

Definition at line 29 of file blobbox.h.

{
PITCH_DUNNO, // insufficient data
PITCH_DEF_FIXED, // definitely fixed
PITCH_MAYBE_FIXED, // could be
PITCH_DEF_PROP,
PITCH_MAYBE_PROP,
PITCH_CORR_FIXED,
PITCH_CORR_PROP
};

enum TabType

Enumerator:

  TT_NONE |
  TT_DELETED |
  TT_MAYBE_RAGGED |
  TT_MAYBE_ALIGNED |
  TT_CONFIRMED |
  TT_VLINE |

Definition at line 44 of file blobbox.h.

{
TT_NONE, // Not a tab.
TT_DELETED, // Not a tab after detailed analysis.
TT_MAYBE_RAGGED, // Initial designation of a tab-stop candidate.
TT_MAYBE_ALIGNED, // Initial designation of a tab-stop candidate.
TT_CONFIRMED, // Aligned with neighbours.
TT_VLINE // Detected as a vertical line.
};

## Function Documentation

TBOX box_next | ( | BLOBNBOX_IT * | it | ) |

Definition at line 585 of file blobbox.cpp.

{
BLOBNBOX *blob; //current blob
TBOX result; //total box
blob = it->data ();
result = blob->bounding_box ();
do {
it->forward ();
blob = it->data ();
if (blob->cblob() == NULL)
//was pre-chopped
result += blob->bounding_box ();
}
//until next real blob
while ((blob->cblob() == NULL) || blob->joined_to_prev());
return result;
}

TBOX box_next_pre_chopped | ( | BLOBNBOX_IT * | it | ) |

Definition at line 614 of file blobbox.cpp.

{
BLOBNBOX *blob; //current blob
TBOX result; //total box
blob = it->data ();
result = blob->bounding_box ();
do {
it->forward ();
blob = it->data ();
}
//until next real blob
while (blob->joined_to_prev ());
return result;
}

C_BLOB* crotate_cblob | ( | C_BLOB * | blob,
|  | FCOORD | rotation
| ) |  |

Definition at line 560 of file blobbox.cpp.

{
C_OUTLINE_LIST out_list; //output outlines
//input outlines
C_OUTLINE_IT in_it = blob->out_list ();
//output outlines
C_OUTLINE_IT out_it = &out_list;
for (in_it.mark_cycle_pt (); !in_it.cycled_list (); in_it.forward ()) {
out_it.add_after_then_move (new C_OUTLINE (in_it.data (), rotation));
}
return new C_BLOB (&out_list);
}

BlobNeighbourDir DirOtherWay | ( | BlobNeighbourDir | dir | ) |

inline

Definition at line 91 of file blobbox.h.

{
return static_cast<BlobNeighbourDir>(dir ^ 2);
}

bool DominatesInMerge | ( | BlobTextFlowType | type1,
|  | BlobTextFlowType | type2
| ) |  |

inline

Definition at line 114 of file blobbox.h.

{
// LEADER always loses.
if (type1 == BTFT_LEADER) return false;
if (type2 == BTFT_LEADER) return true;
// With those out of the way, the ordering of the enum determines the result.
return type1 >= type2;
}

void find_cblob_hlimits | ( | C_BLOB * | blob,
|  | float | bottomy,
|  | float | topy,
|  | float & | xmin,
|  | float & | xymax
| ) |  |

Definition at line 525 of file blobbox.cpp.

{
inT16 stepindex; //current point
ICOORD pos; //current coords
ICOORD vec; //rotated step
C_OUTLINE *outline; //current outline
//outlines
C_OUTLINE_IT out_it = blob->out_list ();
xmin = (float) MAX_INT32;
xmax = (float) -MAX_INT32;
for (out_it.mark_cycle_pt (); !out_it.cycled_list (); out_it.forward ()) {
outline = out_it.data ();
pos = outline->start_pos (); //get coords
for (stepindex = 0; stepindex < outline->pathlength (); stepindex++) {
//inside
if (pos.y () >= bottomy && pos.y () <= topy) {
UpdateRange(pos.x(), &xmin, &xmax);
}
vec = outline->step (stepindex);
pos += vec; //move to next
}
}
}

void find_cblob_limits | ( | C_BLOB * | blob,
|  | float | leftx,
|  | float | rightx,
|  | FCOORD | rotation,
|  | float & | ymin,
|  | float & | ymax
| ) |  |

Definition at line 448 of file blobbox.cpp.

{
inT16 stepindex; //current point
ICOORD pos; //current coords
ICOORD vec; //rotated step
C_OUTLINE *outline; //current outline
//outlines
C_OUTLINE_IT out_it = blob->out_list ();
ymin = (float) MAX_INT32;
ymax = (float) -MAX_INT32;
for (out_it.mark_cycle_pt (); !out_it.cycled_list (); out_it.forward ()) {
outline = out_it.data ();
pos = outline->start_pos (); //get coords
pos.rotate (rotation);
for (stepindex = 0; stepindex < outline->pathlength (); stepindex++) {
//inside
if (pos.x () >= leftx && pos.x () <= rightx) {
UpdateRange(pos.y(), &ymin, &ymax);
}
vec = outline->step (stepindex);
vec.rotate (rotation);
pos += vec; //move to next
}
}
}

void find_cblob_vlimits | ( | C_BLOB * | blob,
|  | float | leftx,
|  | float | rightx,
|  | float & | ymin,
|  | float & | ymax
| ) |  |

Definition at line 488 of file blobbox.cpp.

{
inT16 stepindex; //current point
ICOORD pos; //current coords
ICOORD vec; //rotated step
C_OUTLINE *outline; //current outline
//outlines
C_OUTLINE_IT out_it = blob->out_list ();
ymin = (float) MAX_INT32;
ymax = (float) -MAX_INT32;
for (out_it.mark_cycle_pt (); !out_it.cycled_list (); out_it.forward ()) {
outline = out_it.data ();
pos = outline->start_pos (); //get coords
for (stepindex = 0; stepindex < outline->pathlength (); stepindex++) {
//inside
if (pos.x () >= leftx && pos.x () <= rightx) {
UpdateRange(pos.y(), &ymin, &ymax);
}
vec = outline->step (stepindex);
pos += vec; //move to next
}
}
}

void plot_blob_list | ( | ScrollView * | win,
|  | BLOBNBOX_LIST * | list,
|  | ScrollView::Color | body_colour,
|  | ScrollView::Color | child_colour
| ) |  |

Definition at line 1014 of file blobbox.cpp.

{ // colour of child
BLOBNBOX_IT it = list;
for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
it.data()->plot(win, body_colour, child_colour);
}
}

void vertical_cblob_projection | ( | C_BLOB * | blob,
|  | STATS * | stats
| ) |  |

Definition at line 808 of file blobbox.cpp.

{
//outlines of blob
C_OUTLINE_IT out_it = blob->out_list ();
for (out_it.mark_cycle_pt (); !out_it.cycled_list (); out_it.forward ()) {
vertical_coutline_projection (out_it.data (), stats);
}
}

void vertical_coutline_projection | ( | C_OUTLINE * | outline,
|  | STATS * | stats
| ) |  |

Definition at line 828 of file blobbox.cpp.

{
ICOORD pos; //current point
ICOORD step; //edge step
inT32 length; //of outline
inT16 stepindex; //current step
C_OUTLINE_IT out_it = outline->child ();
pos = outline->start_pos ();
length = outline->pathlength ();
for (stepindex = 0; stepindex < length; stepindex++) {
step = outline->step (stepindex);
if (step.x () > 0) {
stats->add (pos.x (), -pos.y ());
} else if (step.x () < 0) {
stats->add (pos.x () - 1, pos.y ());
}
pos += step;
}
for (out_it.mark_cycle_pt (); !out_it.cycled_list (); out_it.forward ()) {
vertical_coutline_projection (out_it.data (), stats);
}
}

## Variable Documentation

double textord_error_weight = 3

"Weighting for error in believability"