Tesseract  3.02
TO_BLOCK Class Reference

#include <blobbox.h>

Inheritance diagram for TO_BLOCK:
ELIST_LINK

List of all members.

Public Member Functions

 TO_BLOCK ()
 TO_BLOCK (BLOCK *src_block)
 ~TO_BLOCK ()
void clear ()
TO_ROW_LIST * get_rows ()
void rotate (const FCOORD &rotation)
void print_rows ()
void ReSetAndReFilterBlobs ()
void DeleteUnownedNoise ()
void plot_noise_blobs (ScrollView *to_win)
void plot_graded_blobs (ScrollView *to_win)

Public Attributes

BLOBNBOX_LIST blobs
BLOBNBOX_LIST underlines
BLOBNBOX_LIST noise_blobs
BLOBNBOX_LIST small_blobs
BLOBNBOX_LIST large_blobs
BLOCKblock
PITCH_TYPE pitch_decision
float line_spacing
float line_size
float max_blob_size
float baseline_offset
float xheight
float fixed_pitch
float kern_size
float space_size
inT32 min_space
inT32 max_nonspace
float fp_space
float fp_nonsp
float pr_space
float pr_nonsp
TO_ROWkey_row

Detailed Description

Definition at line 667 of file blobbox.h.


Constructor & Destructor Documentation

TO_BLOCK::TO_BLOCK ( ) [inline]

Definition at line 670 of file blobbox.h.

               : pitch_decision(PITCH_DUNNO) {
      clear();
    }                            //empty
TO_BLOCK::TO_BLOCK ( BLOCK src_block)

Definition at line 850 of file blobbox.cpp.

                    {
  clear();
  block = src_block;
}
TO_BLOCK::~TO_BLOCK ( )

Definition at line 894 of file blobbox.cpp.

                    {
  // Any residual BLOBNBOXes at this stage own their blobs, so delete them.
  clear_blobnboxes(&blobs);
  clear_blobnboxes(&underlines);
  clear_blobnboxes(&noise_blobs);
  clear_blobnboxes(&small_blobs);
  clear_blobnboxes(&large_blobs);
}

Member Function Documentation

void TO_BLOCK::clear ( )

Definition at line 873 of file blobbox.cpp.

                     {
  block = NULL;
  pitch_decision = PITCH_DUNNO;
  line_spacing = 0.0;
  line_size = 0.0;
  max_blob_size = 0.0;
  baseline_offset = 0.0;
  xheight = 0.0;
  fixed_pitch = 0.0;
  kern_size = 0.0;
  space_size = 0.0;
  min_space = 0;
  max_nonspace = 0;
  fp_space = 0.0;
  fp_nonsp = 0.0;
  pr_space = 0.0;
  pr_nonsp = 0.0;
  key_row = NULL;
}
TO_ROW_LIST* TO_BLOCK::get_rows ( ) [inline]

Definition at line 679 of file blobbox.h.

                            {  //access function
      return &row_list;
    }
void TO_BLOCK::print_rows ( ) [inline]

Definition at line 709 of file blobbox.h.

                      {  //debug info
      TO_ROW_IT row_it = &row_list;
      TO_ROW *row;

      for (row_it.mark_cycle_pt (); !row_it.cycled_list ();
      row_it.forward ()) {
        row = row_it.data ();
        printf ("Row range (%g,%g), para_c=%g, blobcount=" INT32FORMAT
          "\n", row->min_y (), row->max_y (), row->parallel_c (),
          row->blob_list ()->length ());
      }
    }
void TO_BLOCK::ReSetAndReFilterBlobs ( )

Definition at line 940 of file blobbox.cpp.

                                     {
  int min_height = IntCastRounded(kMinMediumSizeRatio * line_size);
  int max_height = IntCastRounded(kMaxMediumSizeRatio * line_size);
  BLOBNBOX_LIST noise_list;
  BLOBNBOX_LIST small_list;
  BLOBNBOX_LIST medium_list;
  BLOBNBOX_LIST large_list;
  SizeFilterBlobs(min_height, max_height, &blobs,
                  &noise_list, &small_list, &medium_list, &large_list);
  SizeFilterBlobs(min_height, max_height, &large_blobs,
                  &noise_list, &small_list, &medium_list, &large_list);
  SizeFilterBlobs(min_height, max_height, &small_blobs,
                  &noise_list, &small_list, &medium_list, &large_list);
  SizeFilterBlobs(min_height, max_height, &noise_blobs,
                  &noise_list, &small_list, &medium_list, &large_list);
  BLOBNBOX_IT blob_it(&blobs);
  blob_it.add_list_after(&medium_list);
  blob_it.set_to_list(&large_blobs);
  blob_it.add_list_after(&large_list);
  blob_it.set_to_list(&small_blobs);
  blob_it.add_list_after(&small_list);
  blob_it.set_to_list(&noise_blobs);
  blob_it.add_list_after(&noise_list);
}
void TO_BLOCK::rotate ( const FCOORD rotation) [inline]

Definition at line 685 of file blobbox.h.

                                        {
      BLOBNBOX_LIST* blobnbox_list[] = {&blobs, &underlines, &noise_blobs,
                                        &small_blobs, &large_blobs, NULL};
      for (BLOBNBOX_LIST** list = blobnbox_list; *list != NULL; ++list) {
        BLOBNBOX_IT it(*list);
        for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
          it.data()->rotate(rotation);
        }
      }
      // Rotate the block
      ASSERT_HOST(block->poly_block() != NULL);
      block->rotate(rotation);
      // Update the median size statistic from the blobs list.
      STATS widths(0, block->bounding_box().width());
      STATS heights(0, block->bounding_box().height());
      BLOBNBOX_IT blob_it(&blobs);
      for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
        widths.add(blob_it.data()->bounding_box().width(), 1);
        heights.add(blob_it.data()->bounding_box().height(), 1);
      }
      block->set_median_size(static_cast<int>(widths.median() + 0.5),
                             static_cast<int>(heights.median() + 0.5));
    }

Member Data Documentation

Definition at line 753 of file blobbox.h.

BLOBNBOX_LIST TO_BLOCK::blobs

Definition at line 738 of file blobbox.h.

Definition at line 743 of file blobbox.h.

Definition at line 755 of file blobbox.h.

Definition at line 761 of file blobbox.h.

Definition at line 760 of file blobbox.h.

Definition at line 756 of file blobbox.h.

Definition at line 764 of file blobbox.h.

BLOBNBOX_LIST TO_BLOCK::large_blobs

Definition at line 742 of file blobbox.h.

Definition at line 751 of file blobbox.h.

Definition at line 745 of file blobbox.h.

Definition at line 752 of file blobbox.h.

Definition at line 759 of file blobbox.h.

Definition at line 758 of file blobbox.h.

BLOBNBOX_LIST TO_BLOCK::noise_blobs

Definition at line 740 of file blobbox.h.

Definition at line 744 of file blobbox.h.

Definition at line 763 of file blobbox.h.

Definition at line 762 of file blobbox.h.

BLOBNBOX_LIST TO_BLOCK::small_blobs

Definition at line 741 of file blobbox.h.

Definition at line 757 of file blobbox.h.

BLOBNBOX_LIST TO_BLOCK::underlines

Definition at line 739 of file blobbox.h.

Definition at line 754 of file blobbox.h.


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