Skip to main content

Module segmenter

Module segmenter 

Source
Expand description

Line Segmentation

This module handles the segmentation of document images into individual text lines using horizontal projection profile analysis.

Structs§

BBox
Bounding box for a line segment
LineSegment
Result of line segmentation
LineSegmenter
Line segmenter using horizontal projection profile

Constants§

CUT_INK_THRESHOLD
A column counts as carrying ink below this grayscale value.
CUT_SEARCH_FRACTION
Where a tile may be cut, as a fraction of the tile width, searching backwards from the ideal boundary. 0.12 of a 1024px window is ~123px, roughly two Mon glyphs — wide enough to find a gap, narrow enough that tiles stay near full width.
DEFAULT_DENSITY_THRESHOLD_RATIO
The gap threshold this segmenter has always used, kept as the default so existing callers segment identically.

Functions§

cut_column
Where to end a tile that starts at x0 and may not pass ideal.
tile_line
Split one line crop into pieces that each fit the model window.