#include <colpartition.h>
Public Member Functions | |
ColPartition () | |
ColPartition (BlobRegionType blob_type, const ICOORD &vertical) | |
~ColPartition () | |
const TBOX & | bounding_box () const |
int | left_margin () const |
void | set_left_margin (int margin) |
int | right_margin () const |
void | set_right_margin (int margin) |
int | median_top () const |
int | median_bottom () const |
int | median_left () const |
int | median_right () const |
int | median_size () const |
void | set_median_size (int size) |
int | median_width () const |
void | set_median_width (int width) |
BlobRegionType | blob_type () const |
void | set_blob_type (BlobRegionType t) |
BlobTextFlowType | flow () const |
void | set_flow (BlobTextFlowType f) |
int | good_blob_score () const |
bool | good_width () const |
bool | good_column () const |
bool | left_key_tab () const |
int | left_key () const |
bool | right_key_tab () const |
int | right_key () const |
PolyBlockType | type () const |
void | set_type (PolyBlockType t) |
BLOBNBOX_CLIST * | boxes () |
int | boxes_count () const |
void | set_vertical (const ICOORD &v) |
ColPartition_CLIST * | upper_partners () |
ColPartition_CLIST * | lower_partners () |
void | set_working_set (WorkingPartSet *working_set) |
bool | block_owned () const |
void | set_block_owned (bool owned) |
bool | desperately_merged () const |
ColPartitionSet * | column_set () const |
void | set_side_step (int step) |
int | bottom_spacing () const |
void | set_bottom_spacing (int spacing) |
int | top_spacing () const |
void | set_top_spacing (int spacing) |
void | set_table_type () |
void | clear_table_type () |
bool | inside_table_column () |
void | set_inside_table_column (bool val) |
ColPartition * | nearest_neighbor_above () const |
void | set_nearest_neighbor_above (ColPartition *part) |
ColPartition * | nearest_neighbor_below () const |
void | set_nearest_neighbor_below (ColPartition *part) |
int | space_above () const |
void | set_space_above (int space) |
int | space_below () const |
void | set_space_below (int space) |
int | space_to_left () const |
void | set_space_to_left (int space) |
int | space_to_right () const |
void | set_space_to_right (int space) |
uinT8 * | color1 () |
uinT8 * | color2 () |
bool | owns_blobs () const |
void | set_owns_blobs (bool owns_blobs) |
int | MidY () const |
int | MedianY () const |
int | MidX () const |
int | SortKey (int x, int y) const |
int | XAtY (int sort_key, int y) const |
int | KeyWidth (int left_key, int right_key) const |
int | ColumnWidth () const |
int | BoxLeftKey () const |
int | BoxRightKey () const |
int | LeftAtY (int y) const |
int | RightAtY (int y) const |
bool | IsLeftOf (const ColPartition &other) const |
bool | ColumnContains (int x, int y) const |
bool | IsEmpty () const |
bool | IsSingleton () const |
bool | HOverlaps (const ColPartition &other) const |
bool | VOverlaps (const ColPartition &other) const |
int | VCoreOverlap (const ColPartition &other) const |
int | HCoreOverlap (const ColPartition &other) const |
bool | VSignificantCoreOverlap (const ColPartition &other) const |
bool | WithinSameMargins (const ColPartition &other) const |
bool | TypesMatch (const ColPartition &other) const |
bool | IsLineType () const |
bool | IsImageType () const |
bool | IsTextType () const |
bool | IsVerticalType () const |
bool | IsHorizontalType () const |
bool | IsUnMergeableType () const |
bool | IsVerticalLine () const |
bool | IsHorizontalLine () const |
void | AddBox (BLOBNBOX *box) |
void | RemoveBox (BLOBNBOX *box) |
BLOBNBOX * | BiggestBox () |
TBOX | BoundsWithoutBox (BLOBNBOX *box) |
void | ClaimBoxes () |
void | DisownBoxes () |
void | DeleteBoxes () |
void | ReflectInYAxis () |
bool | IsLegal () |
bool | MatchingColumns (const ColPartition &other) const |
bool | MatchingTextColor (const ColPartition &other) const |
bool | MatchingSizes (const ColPartition &other) const |
bool | ConfirmNoTabViolation (const ColPartition &other) const |
bool | MatchingStrokeWidth (const ColPartition &other, double fractional_tolerance, double constant_tolerance) const |
bool | OKDiacriticMerge (const ColPartition &candidate, bool debug) const |
void | SetLeftTab (const TabVector *tab_vector) |
void | SetRightTab (const TabVector *tab_vector) |
void | CopyLeftTab (const ColPartition &src, bool take_box) |
void | CopyRightTab (const ColPartition &src, bool take_box) |
int | LeftBlobRule () const |
int | RightBlobRule () const |
float | SpecialBlobsDensity (const BlobSpecialTextType type) const |
int | SpecialBlobsCount (const BlobSpecialTextType type) |
void | SetSpecialBlobsDensity (const BlobSpecialTextType type, const float density) |
void | ComputeSpecialBlobsDensity () |
void | AddPartner (bool upper, ColPartition *partner) |
void | RemovePartner (bool upper, ColPartition *partner) |
ColPartition * | SingletonPartner (bool upper) |
void | Absorb (ColPartition *other, WidthCallback *cb) |
bool | OKMergeOverlap (const ColPartition &merge1, const ColPartition &merge2, int ok_box_overlap, bool debug) |
BLOBNBOX * | OverlapSplitBlob (const TBOX &box) |
ColPartition * | SplitAtBlob (BLOBNBOX *split_blob) |
ColPartition * | SplitAt (int split_x) |
void | ComputeLimits () |
int | CountOverlappingBoxes (const TBOX &box) |
void | SetPartitionType (int resolution, ColPartitionSet *columns) |
PolyBlockType | PartitionType (ColumnSpanningType flow) const |
void | ColumnRange (int resolution, ColPartitionSet *columns, int *first_col, int *last_col) |
void | SetColumnGoodness (WidthCallback *cb) |
bool | MarkAsLeaderIfMonospaced () |
void | SetRegionAndFlowTypesFromProjectionValue (int value) |
void | SetBlobTypes () |
bool | HasGoodBaseline () |
void | AddToWorkingSet (const ICOORD &bleft, const ICOORD &tright, int resolution, ColPartition_LIST *used_parts, WorkingPartSet_LIST *working_set) |
ColPartition * | ShallowCopy () const |
ColPartition * | CopyButDontOwnBlobs () |
ScrollView::Color | BoxColor () const |
void | Print () const |
void | PrintColors () |
void | SmoothPartnerRun (int working_set_count) |
void | RefinePartners (PolyBlockType type, bool get_desparate, ColPartitionGrid *grid) |
bool | IsInSameColumnAs (const ColPartition &part) const |
void | set_first_column (int column) |
void | set_last_column (int column) |
Static Public Member Functions | |
static ColPartition * | MakeLinePartition (BlobRegionType blob_type, const ICOORD &vertical, int left, int bottom, int right, int top) |
static ColPartition * | FakePartition (const TBOX &box, PolyBlockType block_type, BlobRegionType blob_type, BlobTextFlowType flow) |
static ColPartition * | MakeBigPartition (BLOBNBOX *box, ColPartition_LIST *big_part_list) |
static bool | TypesMatch (BlobRegionType type1, BlobRegionType type2) |
static bool | TypesSimilar (PolyBlockType type1, PolyBlockType type2) |
static void | LineSpacingBlocks (const ICOORD &bleft, const ICOORD &tright, int resolution, ColPartition_LIST *block_parts, ColPartition_LIST *used_parts, BLOCK_LIST *completed_blocks, TO_BLOCK_LIST *to_blocks) |
static TO_BLOCK * | MakeBlock (const ICOORD &bleft, const ICOORD &tright, ColPartition_LIST *block_parts, ColPartition_LIST *used_parts) |
static TO_BLOCK * | MakeVerticalTextBlock (const ICOORD &bleft, const ICOORD &tright, ColPartition_LIST *block_parts, ColPartition_LIST *used_parts) |
ColPartition is a partition of a horizontal slice of the page. It starts out as a collection of blobs at a particular y-coord in the grid, but ends up (after merging and uniquing) as an approximate text line. ColPartitions are also used to hold a partitioning of the page into columns, each representing one column. Although a ColPartition applies to a given y-coordinate range, eventually, a ColPartitionSet of ColPartitions emerges, which represents the columns over a wide y-coordinate range.
tesseract::ColPartition::ColPartition | ( | ) | [inline] |
tesseract::ColPartition::ColPartition | ( | BlobRegionType | blob_type, | |
const ICOORD & | vertical | |||
) |
blob_type | is the blob_region_type_ of the blobs in this partition. | |
vertical | is the direction of logical vertical on the possibly skewed image. |
tesseract::ColPartition::~ColPartition | ( | ) |
void tesseract::ColPartition::Absorb | ( | ColPartition * | other, | |
WidthCallback * | cb | |||
) |
void tesseract::ColPartition::AddBox | ( | BLOBNBOX * | box | ) |
void tesseract::ColPartition::AddPartner | ( | bool | upper, | |
ColPartition * | partner | |||
) |
void tesseract::ColPartition::AddToWorkingSet | ( | const ICOORD & | bleft, | |
const ICOORD & | tright, | |||
int | resolution, | |||
ColPartition_LIST * | used_parts, | |||
WorkingPartSet_LIST * | working_set | |||
) |
BLOBNBOX * tesseract::ColPartition::BiggestBox | ( | ) |
BlobRegionType tesseract::ColPartition::blob_type | ( | ) | const [inline] |
bool tesseract::ColPartition::block_owned | ( | ) | const [inline] |
int tesseract::ColPartition::bottom_spacing | ( | ) | const [inline] |
const TBOX& tesseract::ColPartition::bounding_box | ( | ) | const [inline] |
ScrollView::Color tesseract::ColPartition::BoxColor | ( | ) | const |
BLOBNBOX_CLIST* tesseract::ColPartition::boxes | ( | ) | [inline] |
int tesseract::ColPartition::boxes_count | ( | ) | const [inline] |
int tesseract::ColPartition::BoxLeftKey | ( | ) | const [inline] |
int tesseract::ColPartition::BoxRightKey | ( | ) | const [inline] |
void tesseract::ColPartition::ClaimBoxes | ( | ) |
void tesseract::ColPartition::clear_table_type | ( | ) | [inline] |
uinT8* tesseract::ColPartition::color1 | ( | ) | [inline] |
uinT8* tesseract::ColPartition::color2 | ( | ) | [inline] |
ColPartitionSet* tesseract::ColPartition::column_set | ( | ) | const [inline] |
bool tesseract::ColPartition::ColumnContains | ( | int | x, | |
int | y | |||
) | const [inline] |
void tesseract::ColPartition::ColumnRange | ( | int | resolution, | |
ColPartitionSet * | columns, | |||
int * | first_col, | |||
int * | last_col | |||
) |
int tesseract::ColPartition::ColumnWidth | ( | ) | const [inline] |
void tesseract::ColPartition::ComputeLimits | ( | ) |
void tesseract::ColPartition::ComputeSpecialBlobsDensity | ( | ) |
bool tesseract::ColPartition::ConfirmNoTabViolation | ( | const ColPartition & | other | ) | const |
ColPartition * tesseract::ColPartition::CopyButDontOwnBlobs | ( | ) |
void tesseract::ColPartition::CopyLeftTab | ( | const ColPartition & | src, | |
bool | take_box | |||
) |
void tesseract::ColPartition::CopyRightTab | ( | const ColPartition & | src, | |
bool | take_box | |||
) |
int tesseract::ColPartition::CountOverlappingBoxes | ( | const TBOX & | box | ) |
void tesseract::ColPartition::DeleteBoxes | ( | ) |
bool tesseract::ColPartition::desperately_merged | ( | ) | const [inline] |
void tesseract::ColPartition::DisownBoxes | ( | ) |
ColPartition * tesseract::ColPartition::FakePartition | ( | const TBOX & | box, | |
PolyBlockType | block_type, | |||
BlobRegionType | blob_type, | |||
BlobTextFlowType | flow | |||
) | [static] |
BlobTextFlowType tesseract::ColPartition::flow | ( | ) | const [inline] |
int tesseract::ColPartition::good_blob_score | ( | ) | const [inline] |
bool tesseract::ColPartition::good_column | ( | ) | const [inline] |
bool tesseract::ColPartition::good_width | ( | ) | const [inline] |
bool tesseract::ColPartition::HasGoodBaseline | ( | ) |
int tesseract::ColPartition::HCoreOverlap | ( | const ColPartition & | other | ) | const [inline] |
bool tesseract::ColPartition::HOverlaps | ( | const ColPartition & | other | ) | const [inline] |
bool tesseract::ColPartition::inside_table_column | ( | ) | [inline] |
bool tesseract::ColPartition::IsEmpty | ( | ) | const [inline] |
bool tesseract::ColPartition::IsHorizontalLine | ( | ) | const [inline] |
bool tesseract::ColPartition::IsHorizontalType | ( | ) | const [inline] |
bool tesseract::ColPartition::IsImageType | ( | ) | const [inline] |
bool tesseract::ColPartition::IsInSameColumnAs | ( | const ColPartition & | part | ) | const |
bool tesseract::ColPartition::IsLeftOf | ( | const ColPartition & | other | ) | const [inline] |
bool tesseract::ColPartition::IsLegal | ( | ) |
bool tesseract::ColPartition::IsLineType | ( | ) | const [inline] |
bool tesseract::ColPartition::IsSingleton | ( | ) | const [inline] |
bool tesseract::ColPartition::IsTextType | ( | ) | const [inline] |
bool tesseract::ColPartition::IsUnMergeableType | ( | ) | const [inline] |
bool tesseract::ColPartition::IsVerticalLine | ( | ) | const [inline] |
bool tesseract::ColPartition::IsVerticalType | ( | ) | const [inline] |
int tesseract::ColPartition::KeyWidth | ( | int | left_key, | |
int | right_key | |||
) | const [inline] |
int tesseract::ColPartition::left_key | ( | ) | const [inline] |
bool tesseract::ColPartition::left_key_tab | ( | ) | const [inline] |
int tesseract::ColPartition::left_margin | ( | ) | const [inline] |
int tesseract::ColPartition::LeftAtY | ( | int | y | ) | const [inline] |
int tesseract::ColPartition::LeftBlobRule | ( | ) | const |
void tesseract::ColPartition::LineSpacingBlocks | ( | const ICOORD & | bleft, | |
const ICOORD & | tright, | |||
int | resolution, | |||
ColPartition_LIST * | block_parts, | |||
ColPartition_LIST * | used_parts, | |||
BLOCK_LIST * | completed_blocks, | |||
TO_BLOCK_LIST * | to_blocks | |||
) | [static] |
ColPartition_CLIST* tesseract::ColPartition::lower_partners | ( | ) | [inline] |
ColPartition * tesseract::ColPartition::MakeBigPartition | ( | BLOBNBOX * | box, | |
ColPartition_LIST * | big_part_list | |||
) | [static] |
TO_BLOCK * tesseract::ColPartition::MakeBlock | ( | const ICOORD & | bleft, | |
const ICOORD & | tright, | |||
ColPartition_LIST * | block_parts, | |||
ColPartition_LIST * | used_parts | |||
) | [static] |
ColPartition * tesseract::ColPartition::MakeLinePartition | ( | BlobRegionType | blob_type, | |
const ICOORD & | vertical, | |||
int | left, | |||
int | bottom, | |||
int | right, | |||
int | top | |||
) | [static] |
Constructs a fake ColPartition with no BLOBNBOXes to represent a horizontal or vertical line, given a type and a bounding box.
TO_BLOCK * tesseract::ColPartition::MakeVerticalTextBlock | ( | const ICOORD & | bleft, | |
const ICOORD & | tright, | |||
ColPartition_LIST * | block_parts, | |||
ColPartition_LIST * | used_parts | |||
) | [static] |
bool tesseract::ColPartition::MarkAsLeaderIfMonospaced | ( | ) |
bool tesseract::ColPartition::MatchingColumns | ( | const ColPartition & | other | ) | const |
bool tesseract::ColPartition::MatchingSizes | ( | const ColPartition & | other | ) | const |
bool tesseract::ColPartition::MatchingStrokeWidth | ( | const ColPartition & | other, | |
double | fractional_tolerance, | |||
double | constant_tolerance | |||
) | const |
bool tesseract::ColPartition::MatchingTextColor | ( | const ColPartition & | other | ) | const |
int tesseract::ColPartition::median_bottom | ( | ) | const [inline] |
int tesseract::ColPartition::median_left | ( | ) | const [inline] |
int tesseract::ColPartition::median_right | ( | ) | const [inline] |
int tesseract::ColPartition::median_size | ( | ) | const [inline] |
int tesseract::ColPartition::median_top | ( | ) | const [inline] |
int tesseract::ColPartition::median_width | ( | ) | const [inline] |
int tesseract::ColPartition::MedianY | ( | ) | const [inline] |
int tesseract::ColPartition::MidX | ( | ) | const [inline] |
int tesseract::ColPartition::MidY | ( | ) | const [inline] |
ColPartition* tesseract::ColPartition::nearest_neighbor_above | ( | ) | const [inline] |
ColPartition* tesseract::ColPartition::nearest_neighbor_below | ( | ) | const [inline] |
bool tesseract::ColPartition::OKDiacriticMerge | ( | const ColPartition & | candidate, | |
bool | debug | |||
) | const |
bool tesseract::ColPartition::OKMergeOverlap | ( | const ColPartition & | merge1, | |
const ColPartition & | merge2, | |||
int | ok_box_overlap, | |||
bool | debug | |||
) |
bool tesseract::ColPartition::owns_blobs | ( | ) | const [inline] |
PolyBlockType tesseract::ColPartition::PartitionType | ( | ColumnSpanningType | flow | ) | const |
void tesseract::ColPartition::Print | ( | ) | const |
void tesseract::ColPartition::PrintColors | ( | ) |
void tesseract::ColPartition::RefinePartners | ( | PolyBlockType | type, | |
bool | get_desparate, | |||
ColPartitionGrid * | grid | |||
) |
void tesseract::ColPartition::ReflectInYAxis | ( | ) |
void tesseract::ColPartition::RemoveBox | ( | BLOBNBOX * | box | ) |
void tesseract::ColPartition::RemovePartner | ( | bool | upper, | |
ColPartition * | partner | |||
) |
int tesseract::ColPartition::right_key | ( | ) | const [inline] |
bool tesseract::ColPartition::right_key_tab | ( | ) | const [inline] |
int tesseract::ColPartition::right_margin | ( | ) | const [inline] |
int tesseract::ColPartition::RightAtY | ( | int | y | ) | const [inline] |
int tesseract::ColPartition::RightBlobRule | ( | ) | const |
void tesseract::ColPartition::set_blob_type | ( | BlobRegionType | t | ) | [inline] |
void tesseract::ColPartition::set_block_owned | ( | bool | owned | ) | [inline] |
void tesseract::ColPartition::set_bottom_spacing | ( | int | spacing | ) | [inline] |
void tesseract::ColPartition::set_first_column | ( | int | column | ) | [inline] |
void tesseract::ColPartition::set_flow | ( | BlobTextFlowType | f | ) | [inline] |
void tesseract::ColPartition::set_inside_table_column | ( | bool | val | ) | [inline] |
void tesseract::ColPartition::set_last_column | ( | int | column | ) | [inline] |
void tesseract::ColPartition::set_left_margin | ( | int | margin | ) | [inline] |
void tesseract::ColPartition::set_median_size | ( | int | size | ) | [inline] |
void tesseract::ColPartition::set_median_width | ( | int | width | ) | [inline] |
void tesseract::ColPartition::set_nearest_neighbor_above | ( | ColPartition * | part | ) | [inline] |
void tesseract::ColPartition::set_nearest_neighbor_below | ( | ColPartition * | part | ) | [inline] |
void tesseract::ColPartition::set_owns_blobs | ( | bool | owns_blobs | ) | [inline] |
void tesseract::ColPartition::set_right_margin | ( | int | margin | ) | [inline] |
void tesseract::ColPartition::set_side_step | ( | int | step | ) | [inline] |
void tesseract::ColPartition::set_space_above | ( | int | space | ) | [inline] |
void tesseract::ColPartition::set_space_below | ( | int | space | ) | [inline] |
void tesseract::ColPartition::set_space_to_left | ( | int | space | ) | [inline] |
void tesseract::ColPartition::set_space_to_right | ( | int | space | ) | [inline] |
void tesseract::ColPartition::set_table_type | ( | ) | [inline] |
void tesseract::ColPartition::set_top_spacing | ( | int | spacing | ) | [inline] |
void tesseract::ColPartition::set_type | ( | PolyBlockType | t | ) | [inline] |
void tesseract::ColPartition::set_vertical | ( | const ICOORD & | v | ) | [inline] |
void tesseract::ColPartition::set_working_set | ( | WorkingPartSet * | working_set | ) | [inline] |
void tesseract::ColPartition::SetBlobTypes | ( | ) |
void tesseract::ColPartition::SetColumnGoodness | ( | WidthCallback * | cb | ) |
void tesseract::ColPartition::SetLeftTab | ( | const TabVector * | tab_vector | ) |
void tesseract::ColPartition::SetPartitionType | ( | int | resolution, | |
ColPartitionSet * | columns | |||
) |
void tesseract::ColPartition::SetRegionAndFlowTypesFromProjectionValue | ( | int | value | ) |
void tesseract::ColPartition::SetRightTab | ( | const TabVector * | tab_vector | ) |
void tesseract::ColPartition::SetSpecialBlobsDensity | ( | const BlobSpecialTextType | type, | |
const float | density | |||
) |
ColPartition * tesseract::ColPartition::ShallowCopy | ( | ) | const |
ColPartition * tesseract::ColPartition::SingletonPartner | ( | bool | upper | ) |
void tesseract::ColPartition::SmoothPartnerRun | ( | int | working_set_count | ) |
int tesseract::ColPartition::SortKey | ( | int | x, | |
int | y | |||
) | const [inline] |
int tesseract::ColPartition::space_above | ( | ) | const [inline] |
int tesseract::ColPartition::space_below | ( | ) | const [inline] |
int tesseract::ColPartition::space_to_left | ( | ) | const [inline] |
int tesseract::ColPartition::space_to_right | ( | ) | const [inline] |
int tesseract::ColPartition::SpecialBlobsCount | ( | const BlobSpecialTextType | type | ) |
float tesseract::ColPartition::SpecialBlobsDensity | ( | const BlobSpecialTextType | type | ) | const |
ColPartition * tesseract::ColPartition::SplitAt | ( | int | split_x | ) |
ColPartition * tesseract::ColPartition::SplitAtBlob | ( | BLOBNBOX * | split_blob | ) |
int tesseract::ColPartition::top_spacing | ( | ) | const [inline] |
PolyBlockType tesseract::ColPartition::type | ( | ) | const [inline] |
static bool tesseract::ColPartition::TypesMatch | ( | BlobRegionType | type1, | |
BlobRegionType | type2 | |||
) | [inline, static] |
bool tesseract::ColPartition::TypesMatch | ( | const ColPartition & | other | ) | const [inline] |
static bool tesseract::ColPartition::TypesSimilar | ( | PolyBlockType | type1, | |
PolyBlockType | type2 | |||
) | [inline, static] |
ColPartition_CLIST* tesseract::ColPartition::upper_partners | ( | ) | [inline] |
int tesseract::ColPartition::VCoreOverlap | ( | const ColPartition & | other | ) | const [inline] |
bool tesseract::ColPartition::VOverlaps | ( | const ColPartition & | other | ) | const [inline] |
bool tesseract::ColPartition::VSignificantCoreOverlap | ( | const ColPartition & | other | ) | const [inline] |
bool tesseract::ColPartition::WithinSameMargins | ( | const ColPartition & | other | ) | const [inline] |
int tesseract::ColPartition::XAtY | ( | int | sort_key, | |
int | y | |||
) | const [inline] |