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

#include <werd.h>

Inheritance diagram for WERD:
Collaboration diagram for WERD:

Public Member Functions

 WERD ()=default
 
 WERD (C_BLOB_LIST *blob_list, uint8_t blanks, const char *text)
 
 WERD (C_BLOB_LIST *blob_list, WERD *clone)
 
WERDConstructFromSingleBlob (bool bol, bool eol, C_BLOB *blob)
 
 ~WERD ()=default
 
WERDoperator= (const WERD &source)
 
WERDConstructWerdWithNewBlobs (C_BLOB_LIST *all_blobs, C_BLOB_LIST *orphan_blobs)
 
C_BLOB_LIST * rej_cblob_list ()
 
C_BLOB_LIST * cblob_list ()
 
uint8_t space ()
 
void set_blanks (uint8_t new_blanks)
 
int script_id () const
 
void set_script_id (int id)
 
TBOX bounding_box () const
 
TBOX restricted_bounding_box (bool upper_dots, bool lower_dots) const
 
TBOX true_bounding_box () const
 
const char * text () const
 
void set_text (const char *new_text)
 
bool flag (WERD_FLAGS mask) const
 
void set_flag (WERD_FLAGS mask, bool value)
 
bool display_flag (uint8_t flag) const
 
void set_display_flag (uint8_t flag, bool value)
 
WERDshallow_copy ()
 
void move (const ICOORD vec)
 
void join_on (WERD *other)
 
void copy_on (WERD *other)
 
void print ()
 
void plot (ScrollView *window, ScrollView::Color colour)
 
void plot (ScrollView *window)
 
void plot_rej_blobs (ScrollView *window)
 
void CleanNoise (float size_threshold)
 
void GetNoiseOutlines (GenericVector< C_OUTLINE *> *outlines)
 
bool AddSelectedOutlines (const GenericVector< bool > &wanted, const GenericVector< C_BLOB *> &target_blobs, const GenericVector< C_OUTLINE *> &outlines, bool *make_next_word_fuzzy)
 

Static Public Member Functions

static ScrollView::Color NextColor (ScrollView::Color colour)
 

Private Attributes

uint8_t blanks
 
uint8_t dummy
 
BITS16 flags
 
BITS16 disp_flags
 
int16_t script_id_
 
STRING correct
 
C_BLOB_LIST cblobs
 
C_BLOB_LIST rej_cblobs
 

Constructor & Destructor Documentation

◆ WERD() [1/3]

WERD::WERD ( )
default

◆ WERD() [2/3]

WERD::WERD ( C_BLOB_LIST *  blob_list,
uint8_t  blank_count,
const char *  text 
)

WERD::WERD

Constructor to build a WERD from a list of C_BLOBs. blob_list The C_BLOBs (in word order) are not copied; we take its elements and put them in our lists. blank_count blanks in front of the word text correct text, outlives this WERD

◆ WERD() [3/3]

WERD::WERD ( C_BLOB_LIST *  blob_list,
WERD clone 
)

WERD::WERD

Constructor to build a WERD from a list of C_BLOBs. The C_BLOBs are not copied so the source list is emptied.

◆ ~WERD()

WERD::~WERD ( )
default

Member Function Documentation

◆ AddSelectedOutlines()

bool WERD::AddSelectedOutlines ( const GenericVector< bool > &  wanted,
const GenericVector< C_BLOB *> &  target_blobs,
const GenericVector< C_OUTLINE *> &  outlines,
bool *  make_next_word_fuzzy 
)

◆ bounding_box()

TBOX WERD::bounding_box ( ) const

WERD::bounding_box

Return the bounding box of the WERD. This is quite a mess to compute! ORIGINALLY, REJECT CBLOBS WERE EXCLUDED, however, this led to bugs when the words on the row were re-sorted. The original words were built with reject blobs included. The FUZZY SPACE flags were set accordingly. If ALL the blobs in a word are rejected the BB for the word is nullptr, causing the sort to screw up, leading to the erroneous possibility of the first word in a row being marked as FUZZY space.

◆ cblob_list()

C_BLOB_LIST* WERD::cblob_list ( )
inline

◆ CleanNoise()

void WERD::CleanNoise ( float  size_threshold)

◆ ConstructFromSingleBlob()

WERD * WERD::ConstructFromSingleBlob ( bool  bol,
bool  eol,
C_BLOB blob 
)

◆ ConstructWerdWithNewBlobs()

WERD * WERD::ConstructWerdWithNewBlobs ( C_BLOB_LIST *  all_blobs,
C_BLOB_LIST *  orphan_blobs 
)

WERD::ConstructWerdWithNewBlobs()

This method returns a new werd constructed using the blobs in the input all_blobs list, which correspond to the blobs in this werd object. The blobs used to construct the new word are consumed and removed from the input all_blobs list. Returns nullptr if the word couldn't be constructed. Returns original blobs for which no matches were found in the output list orphan_blobs (appends).

◆ copy_on()

void WERD::copy_on ( WERD other)

WERD::copy_on

Copy blobs from other word onto this one.

◆ display_flag()

bool WERD::display_flag ( uint8_t  flag) const
inline

◆ flag()

bool WERD::flag ( WERD_FLAGS  mask) const
inline

◆ GetNoiseOutlines()

void WERD::GetNoiseOutlines ( GenericVector< C_OUTLINE *> *  outlines)

◆ join_on()

void WERD::join_on ( WERD other)

WERD::join_on

Join other word onto this one. Delete the old word.

◆ move()

void WERD::move ( const ICOORD  vec)

WERD::move

Reposition WERD by vector NOTE!! REJECT CBLOBS ARE NOT MOVED

◆ NextColor()

ScrollView::Color WERD::NextColor ( ScrollView::Color  colour)
static

◆ operator=()

WERD & WERD::operator= ( const WERD source)

WERD::operator=

Assign a word, DEEP copying the blob list

◆ plot() [1/2]

void WERD::plot ( ScrollView window,
ScrollView::Color  colour 
)

WERD::plot

Draw the WERD in the given colour.

◆ plot() [2/2]

void WERD::plot ( ScrollView window)

WERD::plot

Draw the WERD in rainbow colours in window.

◆ plot_rej_blobs()

void WERD::plot_rej_blobs ( ScrollView window)

WERD::plot_rej_blobs

Draw the WERD rejected blobs in window - ALWAYS GREY

◆ print()

void WERD::print ( )

WERD::print

Display members

◆ rej_cblob_list()

C_BLOB_LIST* WERD::rej_cblob_list ( )
inline

◆ restricted_bounding_box()

TBOX WERD::restricted_bounding_box ( bool  upper_dots,
bool  lower_dots 
) const

◆ script_id()

int WERD::script_id ( ) const
inline

◆ set_blanks()

void WERD::set_blanks ( uint8_t  new_blanks)
inline

◆ set_display_flag()

void WERD::set_display_flag ( uint8_t  flag,
bool  value 
)
inline

◆ set_flag()

void WERD::set_flag ( WERD_FLAGS  mask,
bool  value 
)
inline

◆ set_script_id()

void WERD::set_script_id ( int  id)
inline

◆ set_text()

void WERD::set_text ( const char *  new_text)
inline

◆ shallow_copy()

WERD * WERD::shallow_copy ( )

WERD::shallow_copy()

Make a shallow copy of a word

◆ space()

uint8_t WERD::space ( )
inline

◆ text()

const char* WERD::text ( ) const
inline

◆ true_bounding_box()

TBOX WERD::true_bounding_box ( ) const

Member Data Documentation

◆ blanks

uint8_t WERD::blanks
private

◆ cblobs

C_BLOB_LIST WERD::cblobs
private

◆ correct

STRING WERD::correct
private

◆ disp_flags

BITS16 WERD::disp_flags
private

◆ dummy

uint8_t WERD::dummy
private

◆ flags

BITS16 WERD::flags
private

◆ rej_cblobs

C_BLOB_LIST WERD::rej_cblobs
private

◆ script_id_

int16_t WERD::script_id_
private

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