#include <colpartition.h>
Public Member Functions | |
ColPartition ()=default | |
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_height () const |
void | set_median_height (int height) |
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_t * | color1 () |
uint8_t * | 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 | IsPulloutType () 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 | DisownBoxesNoAssert () |
bool | ReleaseNonLeaderBoxes () |
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) |
TO_ROW * | MakeToRow () |
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_desperate, ColPartitionGrid *grid) |
bool | IsInSameColumnAs (const ColPartition &part) const |
void | set_first_column (int column) |
void | set_last_column (int column) |
Public Member Functions inherited from ELIST2_LINK | |
ELIST2_LINK () | |
ELIST2_LINK (const ELIST2_LINK &) | |
void | operator= (const ELIST2_LINK &) |
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) |
static int | SortByBBox (const void *p1, const void *p2) |
Private Types | |
enum | SpacingNeighbourhood { PN_ABOVE2, PN_ABOVE1, PN_UPPER, PN_LOWER, PN_BELOW1, PN_BELOW2, PN_COUNT } |
Private Member Functions | |
void | RefinePartnersInternal (bool upper, bool get_desperate, ColPartitionGrid *grid) |
void | RefinePartnersByType (bool upper, ColPartition_CLIST *partners) |
void | RefinePartnerShortcuts (bool upper, ColPartition_CLIST *partners) |
void | RefineTextPartnersByMerge (bool upper, bool desperate, ColPartition_CLIST *partners, ColPartitionGrid *grid) |
void | RefinePartnersByOverlap (bool upper, ColPartition_CLIST *partners) |
bool | ThisPartitionBetter (BLOBNBOX *bbox, const ColPartition &other) |
bool | SpacingEqual (int spacing, int resolution) const |
bool | SpacingsEqual (const ColPartition &other, int resolution) const |
bool | SummedSpacingOK (const ColPartition &other, int spacing, int resolution) const |
int | BottomSpacingMargin (int resolution) const |
int | TopSpacingMargin (int resolution) const |
bool | SizesSimilar (const ColPartition &other) const |
Static Private Member Functions | |
static void | SmoothSpacings (int resolution, int page_height, ColPartition_LIST *parts) |
static bool | OKSpacingBlip (int resolution, int median_spacing, ColPartition **parts) |
static void | LeftEdgeRun (ColPartition_IT *part_it, ICOORD *start, ICOORD *end) |
static void | RightEdgeRun (ColPartition_IT *part_it, ICOORD *start, ICOORD *end) |
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.
|
private |
|
default |
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 | ( | ) |
|
inline |
|
inline |
|
inline |
|
private |
|
inline |
ScrollView::Color tesseract::ColPartition::BoxColor | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
void tesseract::ColPartition::ClaimBoxes | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void tesseract::ColPartition::ColumnRange | ( | int | resolution, |
ColPartitionSet * | columns, | ||
int * | first_col, | ||
int * | last_col | ||
) |
|
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 | ( | ) |
|
inline |
void tesseract::ColPartition::DisownBoxes | ( | ) |
void tesseract::ColPartition::DisownBoxesNoAssert | ( | ) |
|
static |
|
inline |
|
inline |
|
inline |
|
inline |
bool tesseract::ColPartition::HasGoodBaseline | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool tesseract::ColPartition::IsInSameColumnAs | ( | const ColPartition & | part | ) | const |
|
inline |
bool tesseract::ColPartition::IsLegal | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
int tesseract::ColPartition::LeftBlobRule | ( | ) | const |
|
staticprivate |
|
static |
|
inline |
|
static |
|
static |
|
static |
Constructs a fake ColPartition with no BLOBNBOXes to represent a horizontal or vertical line, given a type and a bounding box.
TO_ROW * tesseract::ColPartition::MakeToRow | ( | ) |
|
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 |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
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 | ||
) |
|
staticprivate |
|
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_desperate, | ||
ColPartitionGrid * | grid | ||
) |
|
private |
|
private |
|
private |
|
private |
|
private |
void tesseract::ColPartition::ReflectInYAxis | ( | ) |
bool tesseract::ColPartition::ReleaseNonLeaderBoxes | ( | ) |
void tesseract::ColPartition::RemoveBox | ( | BLOBNBOX * | box | ) |
void tesseract::ColPartition::RemovePartner | ( | bool | upper, |
ColPartition * | partner | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
int tesseract::ColPartition::RightBlobRule | ( | ) | const |
|
staticprivate |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
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 | ) |
|
private |
void tesseract::ColPartition::SmoothPartnerRun | ( | int | working_set_count | ) |
|
staticprivate |
|
inlinestatic |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
|
private |
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 | ) |
|
private |
|
private |
|
inline |
|
private |
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |