|
| TabFind (int gridsize, const ICOORD &bleft, const ICOORD &tright, TabVector_LIST *vlines, int vertical_x, int vertical_y, int resolution) |
|
virtual | ~TabFind () |
|
void | InsertBlobsToGrid (bool h_spread, bool v_spread, BLOBNBOX_LIST *blobs, BBGrid< BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT > *grid) |
|
bool | InsertBlob (bool h_spread, bool v_spread, BLOBNBOX *blob, BBGrid< BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT > *grid) |
|
void | SetBlockRuleEdges (TO_BLOCK *block) |
|
void | SetBlobRuleEdges (BLOBNBOX_LIST *blobs) |
|
int | GutterWidth (int bottom_y, int top_y, const TabVector &v, bool ignore_unmergeables, int max_gutter_width, int *required_shift) |
|
void | GutterWidthAndNeighbourGap (int tab_x, int mean_height, int max_gutter, bool left, BLOBNBOX *bbox, int *gutter_width, int *neighbour_gap) |
|
int | RightEdgeForBox (const TBOX &box, bool crossing, bool extended) |
|
int | LeftEdgeForBox (const TBOX &box, bool crossing, bool extended) |
|
TabVector * | RightTabForBox (const TBOX &box, bool crossing, bool extended) |
|
TabVector * | LeftTabForBox (const TBOX &box, bool crossing, bool extended) |
|
bool | CommonWidth (int width) |
|
WidthCallback * | WidthCB () |
|
const ICOORD & | image_origin () const |
|
| AlignedBlob (int gridsize, const ICOORD &bleft, const ICOORD &tright) |
|
virtual | ~AlignedBlob () |
|
ScrollView * | DisplayTabs (const char *window_name, ScrollView *tab_win) |
|
TabVector * | FindVerticalAlignment (AlignedBlobParams align_params, BLOBNBOX *bbox, int *vertical_x, int *vertical_y) |
|
| BlobGrid (int gridsize, const ICOORD &bleft, const ICOORD &tright) |
|
virtual | ~BlobGrid () |
|
void | InsertBlobList (BLOBNBOX_LIST *blobs) |
|
| 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) |
|
IntGrid * | CountCellElements () |
|
ScrollView * | MakeWindow (int x, int y, const char *window_name) |
|
void | DisplayBoxes (ScrollView *window) |
|
void | AssertNoDuplicates () |
|
virtual void | HandleClick (int x, int y) |
|
| 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 ICOORD & | bleft () const |
|
const ICOORD & | tright () const |
|
void | GridCoords (int x, int y, int *grid_x, int *grid_y) const |
|
void | ClipGridCoords (int *x, int *y) const |
|
|
TabVector_LIST * | vectors () |
|
TabVector_LIST * | dead_vectors () |
|
bool | FindTabVectors (TabVector_LIST *hlines, BLOBNBOX_LIST *image_blobs, TO_BLOCK *block, int min_gutter_width, double tabfind_aligned_gap_fraction, ColPartitionGrid *part_grid, FCOORD *deskew, FCOORD *reskew) |
|
void | DontFindTabVectors (BLOBNBOX_LIST *image_blobs, TO_BLOCK *block, FCOORD *deskew, FCOORD *reskew) |
|
void | TidyBlobs (TO_BLOCK *block) |
|
void | SetupTabSearch (int x, int y, int *min_key, int *max_key) |
|
ScrollView * | DisplayTabVectors (ScrollView *tab_win) |
|
ScrollView * | FindInitialTabVectors (BLOBNBOX_LIST *image_blobs, int min_gutter_width, double tabfind_aligned_gap_fraction, TO_BLOCK *block) |
|
void | ResetForVerticalText (const FCOORD &rotate, const FCOORD &rerotate, TabVector_LIST *horizontal_lines, int *min_gutter_width) |
|
void | Reset () |
|
void | ReflectInYAxis () |
|
The TabFind class contains code to find tab-stops and maintain the vectors_ list of tab vectors. Also provides an interface to find neighbouring blobs in the grid of BLOBNBOXes that is used by multiple subclasses. Searching is a complex operation because of the need to enforce rule/separator lines, and tabstop boundaries, (when available), so as the holder of the list of TabVectors this class provides the functions.
Definition at line 53 of file tabfind.h.
TabVector * tesseract::TabFind::RightTabForBox |
( |
const TBOX & |
box, |
|
|
bool |
crossing, |
|
|
bool |
extended |
|
) |
| |
Return the TabVector that corresponds to the right edge for the given box. If there is a TabVector to the right that vertically overlaps it, then return it, otherwise return nullptr. Note that Right and Left refer to the position of the TabVector, not its type, ie RightTabForBox returns the nearest TabVector to the right of the box, regardless of its type. If a TabVector crosses right through the box (as opposed to grazing one edge or missing entirely), then crossing false will ignore such a line. Crossing true will return the line for BOTH left and right edges. If extended is true, then TabVectors are considered to extend to their extended_start/end_y, otherwise, just the startpt_ and endpt_. These functions make use of an internal iterator to the vectors_ list for speed when used repeatedly on neighbouring boxes. The caveat is that the iterator must be updated whenever the list is modified.
Definition at line 305 of file tabfind.cpp.
309 int top_y = box.
top();
310 int bottom_y = box.
bottom();
311 int mid_y = (top_y + bottom_y) / 2;
312 int right = crossing ? (box.
left() + box.
right()) / 2 : box.
right();
313 int min_key, max_key;
316 while (!v_it_.at_first() && v_it_.data()->sort_key() >= min_key)
318 while (!v_it_.at_last() && v_it_.data()->sort_key() < min_key)
321 TabVector* best_v =
nullptr;
325 TabVector* v = v_it_.data();
326 int x = v->XAtY(mid_y);
328 (v->VOverlap(top_y, bottom_y) > 0 ||
329 (extended && v->ExtendedOverlap(top_y, bottom_y) > 0))) {
330 if (best_v ==
nullptr || x < best_x) {
335 key_limit = v->sort_key() + max_key - min_key;
340 if (v_it_.at_last() ||
341 (best_v !=
nullptr && v->sort_key() > key_limit))
344 }
while (!v_it_.at_first());
void SetupTabSearch(int x, int y, int *min_key, int *max_key)