Tesseract
3.02
|
#include <blobbox.h>
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 |
BLOCK * | block |
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_ROW * | key_row |
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.
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); }
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; }
void TO_BLOCK::DeleteUnownedNoise | ( | ) |
Definition at line 966 of file blobbox.cpp.
{ BLOBNBOX::CleanNeighbours(&blobs); BLOBNBOX::CleanNeighbours(&small_blobs); BLOBNBOX::CleanNeighbours(&noise_blobs); BLOBNBOX::CleanNeighbours(&large_blobs); BLOBNBOX::DeleteNoiseBlobs(&blobs); BLOBNBOX::DeleteNoiseBlobs(&small_blobs); BLOBNBOX::DeleteNoiseBlobs(&noise_blobs); BLOBNBOX::DeleteNoiseBlobs(&large_blobs); }
TO_ROW_LIST* TO_BLOCK::get_rows | ( | ) | [inline] |
void TO_BLOCK::plot_graded_blobs | ( | ScrollView * | to_win | ) |
Definition at line 987 of file blobbox.cpp.
{ BLOBNBOX::PlotBlobs(&noise_blobs, ScrollView::CORAL, ScrollView::BLUE, win); BLOBNBOX::PlotBlobs(&small_blobs, ScrollView::GOLDENROD, ScrollView::YELLOW, win); BLOBNBOX::PlotBlobs(&large_blobs, ScrollView::DARK_GREEN, ScrollView::YELLOW, win); BLOBNBOX::PlotBlobs(&blobs, ScrollView::WHITE, ScrollView::BROWN, win); }
void TO_BLOCK::plot_noise_blobs | ( | ScrollView * | to_win | ) |
Definition at line 979 of file blobbox.cpp.
{ BLOBNBOX::PlotNoiseBlobs(&noise_blobs, ScrollView::RED, ScrollView::RED, win); BLOBNBOX::PlotNoiseBlobs(&small_blobs, ScrollView::RED, ScrollView::RED, win); BLOBNBOX::PlotNoiseBlobs(&large_blobs, ScrollView::RED, ScrollView::RED, win); BLOBNBOX::PlotNoiseBlobs(&blobs, ScrollView::RED, ScrollView::RED, win); }
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)); }
BLOBNBOX_LIST TO_BLOCK::blobs |
float TO_BLOCK::fixed_pitch |
float TO_BLOCK::fp_nonsp |
float TO_BLOCK::fp_space |
float TO_BLOCK::kern_size |
BLOBNBOX_LIST TO_BLOCK::large_blobs |
float TO_BLOCK::line_size |
float TO_BLOCK::line_spacing |
float TO_BLOCK::max_blob_size |
BLOBNBOX_LIST TO_BLOCK::noise_blobs |
float TO_BLOCK::pr_nonsp |
float TO_BLOCK::pr_space |
BLOBNBOX_LIST TO_BLOCK::small_blobs |
float TO_BLOCK::space_size |
BLOBNBOX_LIST TO_BLOCK::underlines |
float TO_BLOCK::xheight |