Character segmentation (source code)

= Character segmentation

<Character segmentation> separates an image of text into regions or hypotheses associated with individual characters. It is a specialized <image segmentation> problem within <optical character recognition>. The useful boundaries depend on the writing and imaging process: visible connected ink regions need not correspond one-to-one with characters.<An Overview of the Tesseract OCR Engine by Ray Smith>[§2, outlines, text lines and word organization; §§4.1–4.2, chopping joined characters and associating broken ones]{ref}

For example, the dot and stem of a lowercase i can be disconnected regions belonging to one character. Two touching characters can instead form a single connected region. <Connected-component labeling> can locate connected regions, but counting those regions alone therefore cannot reliably count the characters.

A recognizer can compare alternative splits and merges. A degraded image of `rn` may admit one merged-region interpretation as m and a two-character interpretation as r followed by n. The choice depends on shape evidence, spacing and recognition context. Incorrectly committing to one region per character too early can make the correct word unavailable to later stages.

The historical <Tesseract (software)> engine described by <Ray Smith (OCR researcher)> tests cuts when word recognition is unsatisfactory and can also associate broken pieces. Recognition thus supplies feedback about segmentation hypotheses, rather than merely accepting a fixed partition.<An Overview of the Tesseract OCR Engine by Ray Smith>[§4.1, Chopping Joined Characters; §4.2, Associating Broken Characters]{ref}

Character segmentation should be evaluated separately from simply matching the final text. A boundary error can cause several character edits, while a correct boundary can still receive the wrong label. <Character error rate> measures the resulting transcription disagreement; it does not by itself identify which stage caused it.