Tesseract  3.02
tesseract::AlignedBlobParams Struct Reference

#include <alignedblob.h>

List of all members.

Public Member Functions

 AlignedBlobParams (int vertical_x, int vertical_y, int height, int v_gap_multiple, int min_gutter_width, int resolution, TabAlignment alignment0)
 AlignedBlobParams (int vertical_x, int vertical_y, int width)
void set_vertical (int vertical_x, int vertical_y)

Public Attributes

double gutter_fraction
bool right_tab
bool ragged
TabAlignment alignment
TabType confirmed_type
int max_v_gap
int min_gutter
int l_align_tolerance
int r_align_tolerance
int min_points
int min_length
ICOORD vertical

Detailed Description

Definition at line 44 of file alignedblob.h.


Constructor & Destructor Documentation

tesseract::AlignedBlobParams::AlignedBlobParams ( int  vertical_x,
int  vertical_y,
int  height,
int  v_gap_multiple,
int  min_gutter_width,
int  resolution,
TabAlignment  alignment0 
)

Definition at line 94 of file alignedblob.cpp.

  : right_tab(align0 == TA_RIGHT_RAGGED || align0 == TA_RIGHT_ALIGNED),
    ragged(align0 == TA_LEFT_RAGGED || align0 == TA_RIGHT_RAGGED),
    alignment(align0),
    confirmed_type(TT_CONFIRMED),
    min_length(0) {
  // Set the tolerances according to the type of line sought.
  // For tab search, these are based on the image resolution for most, or
  // the height of the starting blob for the maximum vertical gap.
  max_v_gap = height * v_gap_multiple;
  if (ragged) {
    // In the case of a ragged edge, we are much more generous with the
    // inside alignment fraction, but also require a much bigger gutter.
    gutter_fraction = kRaggedGapFraction;
    if (alignment == TA_RIGHT_RAGGED) {
      l_align_tolerance = static_cast<int>(resolution * kRaggedFraction + 0.5);
      r_align_tolerance = static_cast<int>(resolution * kAlignedFraction + 0.5);
    } else {
      l_align_tolerance = static_cast<int>(resolution * kAlignedFraction + 0.5);
      r_align_tolerance = static_cast<int>(resolution * kRaggedFraction + 0.5);
    }
    min_points = kMinRaggedTabs;
  } else {
    gutter_fraction = kAlignedGapFraction;
    l_align_tolerance = static_cast<int>(resolution * kAlignedFraction + 0.5);
    r_align_tolerance = static_cast<int>(resolution * kAlignedFraction + 0.5);
    min_points = kMinAlignedTabs;
  }
  min_gutter = static_cast<int>(height * gutter_fraction + 0.5);
  if (min_gutter < min_gutter_width)
    min_gutter = min_gutter_width;
  // Fit the vertical vector into an ICOORD, which is 16 bit.
  set_vertical(vertical_x, vertical_y);
}
tesseract::AlignedBlobParams::AlignedBlobParams ( int  vertical_x,
int  vertical_y,
int  width 
)

Definition at line 135 of file alignedblob.cpp.

  : gutter_fraction(0.0),
    right_tab(false),
    ragged(false),
    alignment(TA_SEPARATOR),
    confirmed_type(TT_VLINE),
    max_v_gap(kVLineSearchSize),
    min_gutter(kVLineGutter),
    min_points(1),
    min_length(kVLineMinLength) {
  // Compute threshold for left and right alignment.
  l_align_tolerance = MAX(kVLineAlignment, width);
  r_align_tolerance = MAX(kVLineAlignment, width);

  // Fit the vertical vector into an ICOORD, which is 16 bit.
  set_vertical(vertical_x, vertical_y);
}

Member Function Documentation

void tesseract::AlignedBlobParams::set_vertical ( int  vertical_x,
int  vertical_y 
)

Definition at line 155 of file alignedblob.cpp.

                                                                   {
  int factor = 1;
  if (vertical_y > MAX_INT16)
    factor = vertical_y / MAX_INT16 + 1;
  vertical.set_x(vertical_x / factor);
  vertical.set_y(vertical_y / factor);
}

Member Data Documentation

Definition at line 68 of file alignedblob.h.

Definition at line 65 of file alignedblob.h.

Definition at line 64 of file alignedblob.h.


The documentation for this struct was generated from the following files: