tesseract  5.0.0-alpha-619-ge9db
TO_BLOCK Class Reference

#include <blobbox.h>

Inheritance diagram for TO_BLOCK:
ELIST_LINK

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 ComputeEdgeOffsets (Pix *thresholds, Pix *grey)
 
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_t min_space
 
int32_t max_nonspace
 
float fp_space
 
float fp_nonsp
 
float pr_space
 
float pr_nonsp
 
TO_ROWkey_row
 

Detailed Description

Definition at line 691 of file blobbox.h.

Constructor & Destructor Documentation

◆ TO_BLOCK() [1/2]

TO_BLOCK::TO_BLOCK ( )
inline

Definition at line 694 of file blobbox.h.

694  :
696  clear();

◆ TO_BLOCK() [2/2]

TO_BLOCK::TO_BLOCK ( BLOCK src_block)

Definition at line 906 of file blobbox.cpp.

910  {
911  vertical_coutline_projection (out_it.data (), stats);

◆ ~TO_BLOCK()

TO_BLOCK::~TO_BLOCK ( )

Definition at line 948 of file blobbox.cpp.

Member Function Documentation

◆ clear()

void TO_BLOCK::clear ( )

Definition at line 927 of file blobbox.cpp.

929  {
930  BLOBNBOX_IT it = boxes;
931  // A BLOBNBOX generally doesn't own its blobs, so if they do, you
932  // have to delete them explicitly.
933  for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
934  BLOBNBOX* box = it.data();
935  delete box->cblob();
936  }
937 }
938 
939 /**********************************************************************
940  * TO_BLOCK::clear
941  *
942  * Zero out all scalar members.
943  **********************************************************************/
944 void TO_BLOCK::clear() {
945  block = nullptr;

◆ ComputeEdgeOffsets()

void TO_BLOCK::ComputeEdgeOffsets ( Pix *  thresholds,
Pix *  grey 
)

Definition at line 1038 of file blobbox.cpp.

◆ DeleteUnownedNoise()

void TO_BLOCK::DeleteUnownedNoise ( )

Definition at line 1020 of file blobbox.cpp.

◆ get_rows()

TO_ROW_LIST* TO_BLOCK::get_rows ( )
inline

Definition at line 703 of file blobbox.h.

704  { //access function
705  return &row_list;

◆ plot_graded_blobs()

void TO_BLOCK::plot_graded_blobs ( ScrollView to_win)

Definition at line 1054 of file blobbox.cpp.

1055  {
1056  BLOBNBOX::ComputeEdgeOffsets(thresholds, grey, &blobs);
1057  BLOBNBOX::ComputeEdgeOffsets(thresholds, grey, &small_blobs);
1058  BLOBNBOX::ComputeEdgeOffsets(thresholds, grey, &noise_blobs);
1059 }
1060 
1061 #ifndef GRAPHICS_DISABLED

◆ plot_noise_blobs()

void TO_BLOCK::plot_noise_blobs ( ScrollView to_win)

Definition at line 1046 of file blobbox.cpp.

◆ print_rows()

void TO_BLOCK::print_rows ( )
inline

Definition at line 733 of file blobbox.h.

734  { //debug info
735  TO_ROW_IT row_it = &row_list;
736  TO_ROW *row;
737 
738  for (row_it.mark_cycle_pt(); !row_it.cycled_list();
739  row_it.forward()) {
740  row = row_it.data();
741  tprintf("Row range (%g,%g), para_c=%g, blobcount=%" PRId32 "\n",
742  row->min_y(), row->max_y(), row->parallel_c(),
743  row->blob_list()->length());
744  }

◆ ReSetAndReFilterBlobs()

void TO_BLOCK::ReSetAndReFilterBlobs ( )

Definition at line 994 of file blobbox.cpp.

1011  {
1012  int min_height = IntCastRounded(kMinMediumSizeRatio * line_size);
1013  int max_height = IntCastRounded(kMaxMediumSizeRatio * line_size);
1014  BLOBNBOX_LIST noise_list;
1015  BLOBNBOX_LIST small_list;
1016  BLOBNBOX_LIST medium_list;
1017  BLOBNBOX_LIST large_list;

◆ rotate()

void TO_BLOCK::rotate ( const FCOORD rotation)
inline

Definition at line 709 of file blobbox.h.

710  {
711  BLOBNBOX_LIST* blobnbox_list[] = {&blobs, &underlines, &noise_blobs,
712  &small_blobs, &large_blobs, nullptr};
713  for (BLOBNBOX_LIST** list = blobnbox_list; *list != nullptr; ++list) {
714  BLOBNBOX_IT it(*list);
715  for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
716  it.data()->rotate(rotation);
717  }
718  }
719  // Rotate the block
720  ASSERT_HOST(block->pdblk.poly_block() != nullptr);
721  block->rotate(rotation);
722  // Update the median size statistic from the blobs list.
723  STATS widths(0, block->pdblk.bounding_box().width());
724  STATS heights(0, block->pdblk.bounding_box().height());
725  BLOBNBOX_IT blob_it(&blobs);
726  for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) {
727  widths.add(blob_it.data()->bounding_box().width(), 1);
728  heights.add(blob_it.data()->bounding_box().height(), 1);
729  }
730  block->set_median_size(static_cast<int>(widths.median() + 0.5),
731  static_cast<int>(heights.median() + 0.5));

Member Data Documentation

◆ baseline_offset

float TO_BLOCK::baseline_offset

Definition at line 786 of file blobbox.h.

◆ blobs

BLOBNBOX_LIST TO_BLOCK::blobs

Definition at line 771 of file blobbox.h.

◆ block

BLOCK* TO_BLOCK::block

Definition at line 776 of file blobbox.h.

◆ fixed_pitch

float TO_BLOCK::fixed_pitch

Definition at line 788 of file blobbox.h.

◆ fp_nonsp

float TO_BLOCK::fp_nonsp

Definition at line 794 of file blobbox.h.

◆ fp_space

float TO_BLOCK::fp_space

Definition at line 793 of file blobbox.h.

◆ kern_size

float TO_BLOCK::kern_size

Definition at line 789 of file blobbox.h.

◆ key_row

TO_ROW* TO_BLOCK::key_row

Definition at line 797 of file blobbox.h.

◆ large_blobs

BLOBNBOX_LIST TO_BLOCK::large_blobs

Definition at line 775 of file blobbox.h.

◆ line_size

float TO_BLOCK::line_size

Definition at line 784 of file blobbox.h.

◆ line_spacing

float TO_BLOCK::line_spacing

Definition at line 778 of file blobbox.h.

◆ max_blob_size

float TO_BLOCK::max_blob_size

Definition at line 785 of file blobbox.h.

◆ max_nonspace

int32_t TO_BLOCK::max_nonspace

Definition at line 792 of file blobbox.h.

◆ min_space

int32_t TO_BLOCK::min_space

Definition at line 791 of file blobbox.h.

◆ noise_blobs

BLOBNBOX_LIST TO_BLOCK::noise_blobs

Definition at line 773 of file blobbox.h.

◆ pitch_decision

PITCH_TYPE TO_BLOCK::pitch_decision

Definition at line 777 of file blobbox.h.

◆ pr_nonsp

float TO_BLOCK::pr_nonsp

Definition at line 796 of file blobbox.h.

◆ pr_space

float TO_BLOCK::pr_space

Definition at line 795 of file blobbox.h.

◆ small_blobs

BLOBNBOX_LIST TO_BLOCK::small_blobs

Definition at line 774 of file blobbox.h.

◆ space_size

float TO_BLOCK::space_size

Definition at line 790 of file blobbox.h.

◆ underlines

BLOBNBOX_LIST TO_BLOCK::underlines

Definition at line 772 of file blobbox.h.

◆ xheight

float TO_BLOCK::xheight

Definition at line 787 of file blobbox.h.


The documentation for this class was generated from the following files:
TO_BLOCK::small_blobs
BLOBNBOX_LIST small_blobs
Definition: blobbox.h:774
BLOBNBOX::ComputeEdgeOffsets
static void ComputeEdgeOffsets(Pix *thresholds, Pix *grey, BLOBNBOX_LIST *blobs)
Definition: blobbox.cpp:383
kMinMediumSizeRatio
const double kMinMediumSizeRatio
Definition: blobbox.cpp:50
PDBLK::bounding_box
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
Definition: pdblock.h:58
TO_BLOCK::noise_blobs
BLOBNBOX_LIST noise_blobs
Definition: blobbox.h:773
ASSERT_HOST
#define ASSERT_HOST(x)
Definition: errcode.h:87
vertical_coutline_projection
void vertical_coutline_projection(C_OUTLINE *outline, STATS *stats)
Definition: blobbox.cpp:873
TO_ROW::max_y
float max_y() const
Definition: blobbox.h:558
TO_BLOCK::blobs
BLOBNBOX_LIST blobs
Definition: blobbox.h:771
TO_BLOCK::clear
void clear()
Definition: blobbox.cpp:927
IntCastRounded
int IntCastRounded(double x)
Definition: helpers.h:173
BLOBNBOX
Definition: blobbox.h:142
TO_BLOCK::underlines
BLOBNBOX_LIST underlines
Definition: blobbox.h:772
BLOCK::set_median_size
void set_median_size(int x, int y)
Definition: ocrblock.h:154
BLOCK::pdblk
PDBLK pdblk
Page Description Block.
Definition: ocrblock.h:189
TO_BLOCK::large_blobs
BLOBNBOX_LIST large_blobs
Definition: blobbox.h:775
PITCH_DUNNO
Definition: blobbox.h:45
PDBLK::poly_block
POLY_BLOCK * poly_block() const
Definition: pdblock.h:54
TO_BLOCK::block
BLOCK * block
Definition: blobbox.h:776
TO_ROW::parallel_c
float parallel_c() const
Definition: blobbox.h:579
TO_BLOCK::TO_BLOCK
TO_BLOCK()
Definition: blobbox.h:694
TO_BLOCK::pitch_decision
PITCH_TYPE pitch_decision
Definition: blobbox.h:777
STATS
Definition: statistc.h:30
kMaxMediumSizeRatio
const double kMaxMediumSizeRatio
Definition: blobbox.cpp:52
BLOCK::rotate
void rotate(const FCOORD &rotation)
Definition: ocrblock.cpp:77
TO_ROW::min_y
float min_y() const
Definition: blobbox.h:561
tprintf
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:34
TO_ROW
Definition: blobbox.h:543
BLOBNBOX::cblob
C_BLOB * cblob() const
Definition: blobbox.h:267
TO_ROW::blob_list
BLOBNBOX_LIST * blob_list()
Definition: blobbox.h:599
TO_BLOCK::line_size
float line_size
Definition: blobbox.h:784