tesseract  v4.0.0-17-g361f3264
Open Source OCR Engine
tesseract::StrokeWidth Class Reference

#include <strokewidth.h>

Inheritance diagram for tesseract::StrokeWidth:
Collaboration diagram for tesseract::StrokeWidth:

Public Member Functions

 StrokeWidth (int gridsize, const ICOORD &bleft, const ICOORD &tright)
 
virtual ~StrokeWidth ()
 
void SetNeighboursOnMediumBlobs (TO_BLOCK *block)
 
void FindTextlineDirectionAndFixBrokenCJK (PageSegMode pageseg_mode, bool cjk_merge, TO_BLOCK *input_block)
 
bool TestVerticalTextDirection (double find_vertical_text_ratio, TO_BLOCK *block, BLOBNBOX_CLIST *osd_blobs)
 
void CorrectForRotation (const FCOORD &rerotation, ColPartitionGrid *part_grid)
 
void FindLeaderPartitions (TO_BLOCK *block, ColPartitionGrid *part_grid)
 
void RemoveLineResidue (ColPartition_LIST *big_part_list)
 
void GradeBlobsIntoPartitions (PageSegMode pageseg_mode, const FCOORD &rerotation, TO_BLOCK *block, Pix *nontext_pix, const DENORM *denorm, bool cjk_script, TextlineProjection *projection, BLOBNBOX_LIST *diacritic_blobs, ColPartitionGrid *part_grid, ColPartition_LIST *big_parts)
 
virtual void HandleClick (int x, int y)
 
- Public Member Functions inherited from tesseract::BlobGrid
 BlobGrid (int gridsize, const ICOORD &bleft, const ICOORD &tright)
 
virtual ~BlobGrid ()
 
void InsertBlobList (BLOBNBOX_LIST *blobs)
 
- Public Member Functions inherited from tesseract::BBGrid< BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT >
 BBGrid ()
 
 BBGrid (int gridsize, const ICOORD &bleft, const ICOORD &tright)
 
virtual ~BBGrid ()
 
void Init (int gridsize, const ICOORD &bleft, const ICOORD &tright)
 
void Clear ()
 
void ClearGridData (void(*free_method)(BLOBNBOX *))
 
void InsertBBox (bool h_spread, bool v_spread, BLOBNBOX *bbox)
 
void InsertPixPtBBox (int left, int bottom, Pix *pix, BLOBNBOX *bbox)
 
void RemoveBBox (BLOBNBOX *bbox)
 
bool RectangleEmpty (const TBOX &rect)
 
IntGridCountCellElements ()
 
ScrollViewMakeWindow (int x, int y, const char *window_name)
 
void DisplayBoxes (ScrollView *window)
 
void AssertNoDuplicates ()
 
- Public Member Functions inherited from tesseract::GridBase
 GridBase ()=default
 
 GridBase (int gridsize, const ICOORD &bleft, const ICOORD &tright)
 
virtual ~GridBase ()
 
void Init (int gridsize, const ICOORD &bleft, const ICOORD &tright)
 
int gridsize () const
 
int gridwidth () const
 
int gridheight () const
 
const ICOORDbleft () const
 
const ICOORDtright () const
 
void GridCoords (int x, int y, int *grid_x, int *grid_y) const
 
void ClipGridCoords (int *x, int *y) const
 

Private Member Functions

void ComputeNoiseDensity (TO_BLOCK *block, TabFind *line_grid)
 
void FindLeadersAndMarkNoise (TO_BLOCK *block, ColPartition_LIST *leader_parts)
 
void InsertBlobs (TO_BLOCK *block)
 
bool FixBrokenCJK (TO_BLOCK *block)
 
void AccumulateOverlaps (const BLOBNBOX *not_this, bool debug, int max_size, int max_dist, TBOX *bbox, BLOBNBOX_CLIST *blobs)
 
void FindTextlineFlowDirection (PageSegMode pageseg_mode, bool display_if_debugging)
 
void SetNeighbours (bool leaders, bool activate_line_trap, BLOBNBOX *blob)
 
int FindGoodNeighbour (BlobNeighbourDir dir, bool leaders, BLOBNBOX *blob)
 
void SetNeighbourFlows (BLOBNBOX *blob)
 
void SimplifyObviousNeighbours (BLOBNBOX *blob)
 
void SmoothNeighbourTypes (PageSegMode pageseg_mode, bool desperate, BLOBNBOX *blob)
 
void MarkLeaderNeighbours (const ColPartition *part, LeftOrRight side)
 
PartitionFindResult FindInitialPartitions (PageSegMode pageseg_mode, const FCOORD &rerotation, bool find_problems, TO_BLOCK *block, BLOBNBOX_LIST *diacritic_blobs, ColPartitionGrid *part_grid, ColPartition_LIST *big_parts, FCOORD *skew_angle)
 
bool DetectAndRemoveNoise (int pre_overlap, const TBOX &grid_box, TO_BLOCK *block, ColPartitionGrid *part_grid, BLOBNBOX_LIST *diacritic_blobs)
 
void FindVerticalTextChains (ColPartitionGrid *part_grid)
 
void FindHorizontalTextChains (ColPartitionGrid *part_grid)
 
void TestDiacritics (ColPartitionGrid *part_grid, TO_BLOCK *block)
 
bool DiacriticBlob (BlobGrid *small_grid, BLOBNBOX *blob)
 
bool DiacriticXGapFilled (BlobGrid *grid, const TBOX &diacritic_box, const TBOX &base_box)
 
void MergeDiacritics (TO_BLOCK *block, ColPartitionGrid *part_grid)
 
void RemoveLargeUnusedBlobs (TO_BLOCK *block, ColPartitionGrid *part_grid, ColPartition_LIST *big_parts)
 
void PartitionRemainingBlobs (PageSegMode pageseg_mode, ColPartitionGrid *part_grid)
 
void MakePartitionsFromCellList (PageSegMode pageseg_mode, bool combine, ColPartitionGrid *part_grid, BLOBNBOX_CLIST *cell_list)
 
void CompletePartition (PageSegMode pageseg_mode, ColPartition *part, ColPartitionGrid *part_grid)
 
bool FindingVerticalOnly (PageSegMode pageseg_mode) const
 
bool FindingHorizontalOnly (PageSegMode pageseg_mode) const
 
void EasyMerges (ColPartitionGrid *part_grid)
 
bool OrientationSearchBox (ColPartition *part, TBOX *box)
 
bool ConfirmEasyMerge (const ColPartition *p1, const ColPartition *p2)
 
bool NoNoiseInBetween (const TBOX &box1, const TBOX &box2) const
 
ScrollViewDisplayGoodBlobs (const char *window_name, int x, int y)
 
ScrollViewDisplayDiacritics (const char *window_name, int x, int y, TO_BLOCK *block)
 

Private Attributes

Pix * nontext_map_
 
TextlineProjectionprojection_
 
const DENORMdenorm_
 
TBOX grid_box_
 
FCOORD rerotation_
 
ScrollViewleaders_win_
 
ScrollViewinitial_widths_win_
 
ScrollViewwidths_win_
 
ScrollViewchains_win_
 
ScrollViewdiacritics_win_
 
ScrollViewtextlines_win_
 
ScrollViewsmoothed_win_
 

Additional Inherited Members

- Protected Attributes inherited from tesseract::BBGrid< BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT >
BLOBNBOX_CLIST * grid_
 
- Protected Attributes inherited from tesseract::GridBase
int gridsize_
 
int gridwidth_
 
int gridheight_
 
int gridbuckets_
 
ICOORD bleft_
 
ICOORD tright_
 

Detailed Description

The StrokeWidth class holds all the normal and large blobs. It is used to find good large blobs and move them to the normal blobs by virtue of having a reasonable strokewidth compatible neighbour.

Constructor & Destructor Documentation

◆ StrokeWidth()

tesseract::StrokeWidth::StrokeWidth ( int  gridsize,
const ICOORD bleft,
const ICOORD tright 
)

◆ ~StrokeWidth()

tesseract::StrokeWidth::~StrokeWidth ( )
virtual

Member Function Documentation

◆ AccumulateOverlaps()

void tesseract::StrokeWidth::AccumulateOverlaps ( const BLOBNBOX not_this,
bool  debug,
int  max_size,
int  max_dist,
TBOX bbox,
BLOBNBOX_CLIST *  blobs 
)
private

◆ CompletePartition()

void tesseract::StrokeWidth::CompletePartition ( PageSegMode  pageseg_mode,
ColPartition part,
ColPartitionGrid part_grid 
)
private

◆ ComputeNoiseDensity()

void tesseract::StrokeWidth::ComputeNoiseDensity ( TO_BLOCK block,
TabFind line_grid 
)
private

◆ ConfirmEasyMerge()

bool tesseract::StrokeWidth::ConfirmEasyMerge ( const ColPartition p1,
const ColPartition p2 
)
private

◆ CorrectForRotation()

void tesseract::StrokeWidth::CorrectForRotation ( const FCOORD rerotation,
ColPartitionGrid part_grid 
)

◆ DetectAndRemoveNoise()

bool tesseract::StrokeWidth::DetectAndRemoveNoise ( int  pre_overlap,
const TBOX grid_box,
TO_BLOCK block,
ColPartitionGrid part_grid,
BLOBNBOX_LIST *  diacritic_blobs 
)
private

◆ DiacriticBlob()

bool tesseract::StrokeWidth::DiacriticBlob ( BlobGrid small_grid,
BLOBNBOX blob 
)
private

◆ DiacriticXGapFilled()

bool tesseract::StrokeWidth::DiacriticXGapFilled ( BlobGrid grid,
const TBOX diacritic_box,
const TBOX base_box 
)
private

◆ DisplayDiacritics()

ScrollView * tesseract::StrokeWidth::DisplayDiacritics ( const char *  window_name,
int  x,
int  y,
TO_BLOCK block 
)
private

◆ DisplayGoodBlobs()

ScrollView * tesseract::StrokeWidth::DisplayGoodBlobs ( const char *  window_name,
int  x,
int  y 
)
private

Displays the blobs colored according to the number of good neighbours and the vertical/horizontal flow.

◆ EasyMerges()

void tesseract::StrokeWidth::EasyMerges ( ColPartitionGrid part_grid)
private

◆ FindGoodNeighbour()

int tesseract::StrokeWidth::FindGoodNeighbour ( BlobNeighbourDir  dir,
bool  leaders,
BLOBNBOX blob 
)
private

◆ FindHorizontalTextChains()

void tesseract::StrokeWidth::FindHorizontalTextChains ( ColPartitionGrid part_grid)
private

◆ FindingHorizontalOnly()

bool tesseract::StrokeWidth::FindingHorizontalOnly ( PageSegMode  pageseg_mode) const
inlineprivate

◆ FindingVerticalOnly()

bool tesseract::StrokeWidth::FindingVerticalOnly ( PageSegMode  pageseg_mode) const
inlineprivate

◆ FindInitialPartitions()

PartitionFindResult tesseract::StrokeWidth::FindInitialPartitions ( PageSegMode  pageseg_mode,
const FCOORD rerotation,
bool  find_problems,
TO_BLOCK block,
BLOBNBOX_LIST *  diacritic_blobs,
ColPartitionGrid part_grid,
ColPartition_LIST *  big_parts,
FCOORD skew_angle 
)
private

◆ FindLeaderPartitions()

void tesseract::StrokeWidth::FindLeaderPartitions ( TO_BLOCK block,
ColPartitionGrid part_grid 
)

◆ FindLeadersAndMarkNoise()

void tesseract::StrokeWidth::FindLeadersAndMarkNoise ( TO_BLOCK block,
ColPartition_LIST *  leader_parts 
)
private

◆ FindTextlineDirectionAndFixBrokenCJK()

void tesseract::StrokeWidth::FindTextlineDirectionAndFixBrokenCJK ( PageSegMode  pageseg_mode,
bool  cjk_merge,
TO_BLOCK input_block 
)

◆ FindTextlineFlowDirection()

void tesseract::StrokeWidth::FindTextlineFlowDirection ( PageSegMode  pageseg_mode,
bool  display_if_debugging 
)
private

◆ FindVerticalTextChains()

void tesseract::StrokeWidth::FindVerticalTextChains ( ColPartitionGrid part_grid)
private

◆ FixBrokenCJK()

bool tesseract::StrokeWidth::FixBrokenCJK ( TO_BLOCK block)
private

◆ GradeBlobsIntoPartitions()

void tesseract::StrokeWidth::GradeBlobsIntoPartitions ( PageSegMode  pageseg_mode,
const FCOORD rerotation,
TO_BLOCK block,
Pix *  nontext_pix,
const DENORM denorm,
bool  cjk_script,
TextlineProjection projection,
BLOBNBOX_LIST *  diacritic_blobs,
ColPartitionGrid part_grid,
ColPartition_LIST *  big_parts 
)

◆ HandleClick()

void tesseract::StrokeWidth::HandleClick ( int  x,
int  y 
)
virtual

Handles a click event in a display window.

Reimplemented from tesseract::BBGrid< BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT >.

◆ InsertBlobs()

void tesseract::StrokeWidth::InsertBlobs ( TO_BLOCK block)
private

Inserts the block blobs (normal and large) into this grid. Blobs remain owned by the block.

◆ MakePartitionsFromCellList()

void tesseract::StrokeWidth::MakePartitionsFromCellList ( PageSegMode  pageseg_mode,
bool  combine,
ColPartitionGrid part_grid,
BLOBNBOX_CLIST *  cell_list 
)
private

◆ MarkLeaderNeighbours()

void tesseract::StrokeWidth::MarkLeaderNeighbours ( const ColPartition part,
LeftOrRight  side 
)
private

◆ MergeDiacritics()

void tesseract::StrokeWidth::MergeDiacritics ( TO_BLOCK block,
ColPartitionGrid part_grid 
)
private

◆ NoNoiseInBetween()

bool tesseract::StrokeWidth::NoNoiseInBetween ( const TBOX box1,
const TBOX box2 
) const
private

◆ OrientationSearchBox()

bool tesseract::StrokeWidth::OrientationSearchBox ( ColPartition part,
TBOX box 
)
private

◆ PartitionRemainingBlobs()

void tesseract::StrokeWidth::PartitionRemainingBlobs ( PageSegMode  pageseg_mode,
ColPartitionGrid part_grid 
)
private

◆ RemoveLargeUnusedBlobs()

void tesseract::StrokeWidth::RemoveLargeUnusedBlobs ( TO_BLOCK block,
ColPartitionGrid part_grid,
ColPartition_LIST *  big_parts 
)
private

◆ RemoveLineResidue()

void tesseract::StrokeWidth::RemoveLineResidue ( ColPartition_LIST *  big_part_list)

◆ SetNeighbourFlows()

void tesseract::StrokeWidth::SetNeighbourFlows ( BLOBNBOX blob)
private

◆ SetNeighbours()

void tesseract::StrokeWidth::SetNeighbours ( bool  leaders,
bool  activate_line_trap,
BLOBNBOX blob 
)
private

◆ SetNeighboursOnMediumBlobs()

void tesseract::StrokeWidth::SetNeighboursOnMediumBlobs ( TO_BLOCK block)

◆ SimplifyObviousNeighbours()

void tesseract::StrokeWidth::SimplifyObviousNeighbours ( BLOBNBOX blob)
private

◆ SmoothNeighbourTypes()

void tesseract::StrokeWidth::SmoothNeighbourTypes ( PageSegMode  pageseg_mode,
bool  desperate,
BLOBNBOX blob 
)
private

◆ TestDiacritics()

void tesseract::StrokeWidth::TestDiacritics ( ColPartitionGrid part_grid,
TO_BLOCK block 
)
private

◆ TestVerticalTextDirection()

bool tesseract::StrokeWidth::TestVerticalTextDirection ( double  find_vertical_text_ratio,
TO_BLOCK block,
BLOBNBOX_CLIST *  osd_blobs 
)

Member Data Documentation

◆ chains_win_

ScrollView* tesseract::StrokeWidth::chains_win_
private

◆ denorm_

const DENORM* tesseract::StrokeWidth::denorm_
private

◆ diacritics_win_

ScrollView* tesseract::StrokeWidth::diacritics_win_
private

◆ grid_box_

TBOX tesseract::StrokeWidth::grid_box_
private

◆ initial_widths_win_

ScrollView* tesseract::StrokeWidth::initial_widths_win_
private

◆ leaders_win_

ScrollView* tesseract::StrokeWidth::leaders_win_
private

◆ nontext_map_

Pix* tesseract::StrokeWidth::nontext_map_
private

◆ projection_

TextlineProjection* tesseract::StrokeWidth::projection_
private

◆ rerotation_

FCOORD tesseract::StrokeWidth::rerotation_
private

◆ smoothed_win_

ScrollView* tesseract::StrokeWidth::smoothed_win_
private

◆ textlines_win_

ScrollView* tesseract::StrokeWidth::textlines_win_
private

◆ widths_win_

ScrollView* tesseract::StrokeWidth::widths_win_
private

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