New Tool Radar

AI PDF

How to Check OCR Output from a Two-Column Page Reads in Column Order

Run Tesseract with automatic and single-column page segmentation on a two-column page and compare the order.

Schematic with three steps: Run Tesseract with automatic segmentation; Run Tesseract with single-column mode; Compare the sentence order.

A two-column page has one correct reading order: the whole left column, then the whole right column. Tesseract’s page segmentation modes guess the layout, and the wrong guess interleaves the columns, so the OCR text reads as if two articles were shuffled together.

What you need

  • Tesseract installed
  • A scanned image of a two-column page
  • A note of the first and last sentences of each column

Step 1: Run Tesseract with automatic segmentation

Run tesseract page.png auto –psm 3 -l eng. The –psm 3 mode lets Tesseract segment the page automatically.

Step 2: Run Tesseract with single-column mode

Run tesseract page.png single –psm 4 -l eng on the same image. The –psm 4 mode treats the page as a single column of text.

Step 3: Compare the sentence order

Read both outputs and check which one puts the left column first and the right column second. Use the mode that matches the page layout for the rest of the document.

Worked example: synthetic reading-order check on a two-column magazine page

The table below is a synthetic example. It shows the expected result of comparing segmentation modes; no OCR was run.

Output First sentences Verdict
Automatic (–psm 3) Left para 1, right para 1, left para 2 Interleaved – wrong order
Single column (–psm 4) Left para 1, left para 2, right para 1 Correct order
With OSD (–psm 1) Left para 1, right para 1, left para 2 Interleaved – wrong order
Sparse text (–psm 11) Mixed fragments Unusable for this page

Expected result (UNTESTED). automatic segmentation interleaves the two columns, while single-column mode reads the left column first and the right column second. Use –psm 4 for the remaining two-column pages in this document. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Single-column mode only works when the page really is two clean columns; a page with a sidebar or a pull-quote needs a different mode.
  • The best mode can change from page to page in the same document, so check a sample of each layout.
  • Page segmentation cannot fix a scan that is skewed or has merged columns.

Sources

See all