Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 Member Functions inherited from ELIST_LINK
 ELIST_LINK ()
 ELIST_LINK (const ELIST_LINK &)
void operator= (const ELIST_LINK &)

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 664 of file blobbox.h.


Constructor & Destructor Documentation

TO_BLOCK::TO_BLOCK ( )
inline

Definition at line 667 of file blobbox.h.

clear();
} //empty
TO_BLOCK::TO_BLOCK ( BLOCK src_block)

Definition at line 862 of file blobbox.cpp.

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

Definition at line 906 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 885 of file blobbox.cpp.

{
line_spacing = 0.0;
line_size = 0.0;
xheight = 0.0;
fixed_pitch = 0.0;
kern_size = 0.0;
space_size = 0.0;
min_space = 0;
fp_space = 0.0;
fp_nonsp = 0.0;
pr_space = 0.0;
pr_nonsp = 0.0;
}
TO_ROW_LIST* TO_BLOCK::get_rows ( )
inline

Definition at line 676 of file blobbox.h.

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

Definition at line 706 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 952 of file blobbox.cpp.

{
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 682 of file blobbox.h.

{
BLOBNBOX_LIST* blobnbox_list[] = {&blobs, &underlines, &noise_blobs,
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
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

float TO_BLOCK::baseline_offset

Definition at line 750 of file blobbox.h.

BLOBNBOX_LIST TO_BLOCK::blobs

Definition at line 735 of file blobbox.h.

BLOCK* TO_BLOCK::block

Definition at line 740 of file blobbox.h.

float TO_BLOCK::fixed_pitch

Definition at line 752 of file blobbox.h.

float TO_BLOCK::fp_nonsp

Definition at line 758 of file blobbox.h.

float TO_BLOCK::fp_space

Definition at line 757 of file blobbox.h.

float TO_BLOCK::kern_size

Definition at line 753 of file blobbox.h.

TO_ROW* TO_BLOCK::key_row

Definition at line 761 of file blobbox.h.

BLOBNBOX_LIST TO_BLOCK::large_blobs

Definition at line 739 of file blobbox.h.

float TO_BLOCK::line_size

Definition at line 748 of file blobbox.h.

float TO_BLOCK::line_spacing

Definition at line 742 of file blobbox.h.

float TO_BLOCK::max_blob_size

Definition at line 749 of file blobbox.h.

inT32 TO_BLOCK::max_nonspace

Definition at line 756 of file blobbox.h.

inT32 TO_BLOCK::min_space

Definition at line 755 of file blobbox.h.

BLOBNBOX_LIST TO_BLOCK::noise_blobs

Definition at line 737 of file blobbox.h.

PITCH_TYPE TO_BLOCK::pitch_decision

Definition at line 741 of file blobbox.h.

float TO_BLOCK::pr_nonsp

Definition at line 760 of file blobbox.h.

float TO_BLOCK::pr_space

Definition at line 759 of file blobbox.h.

BLOBNBOX_LIST TO_BLOCK::small_blobs

Definition at line 738 of file blobbox.h.

float TO_BLOCK::space_size

Definition at line 754 of file blobbox.h.

BLOBNBOX_LIST TO_BLOCK::underlines

Definition at line 736 of file blobbox.h.

float TO_BLOCK::xheight

Definition at line 751 of file blobbox.h.


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