{
  "id": 19115504,
  "title": "Estimating text height before OCR: connected components held up where projection didn't",
  "url": "https://urgent.news/2026/11/09/estimating-text-height-before-ocr-connected-components-held-up-where",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-09T08:03:41.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/iterandum/estimating-text-height-before-ocr-connected-components-held-up-where-projection-didnt-p08"
  },
  "original_language": "en",
  "account": "A pre-OCR gate that determines whether to upscale a screenshot requires one crucial number from the image itself: the height of the text in pixels. Two inexpensive methods for obtaining this measurement are horizontal projection profiles and connected components, both achievable with just a few lines of OpenCV code. Under clean conditions, both techniques closely approximated the true text height. When the text height ranged from 6 to 40 pixels for Chinese characters and from 6 to 60 pixels for English text, both methods remained within 2 pixels of the actual height. However, when the text height exceeded 60 pixels, the projection method consistently overestimated the text height by approximately 8%.",
  "summary": "A pre-OCR gate that decides whether to upscale a screenshot needs one number from the image itself: how tall the text is in pixels. The two cheapest ways to get it are a horizontal projection profile and connected components, both a few lines of OpenCV. On clean Chinese renders both stayed within 2 px of the true height up to 30 px; above that projection ran 3 to 5 px high and components 1 to 3…",
  "key_points": [
    "Horizontal projection profiles and connected components estimate text height",
    "Both methods accurate for text heights 6-40 pixels for Chinese, 6-60 pixels for English",
    "Projection method overestimates text height >60 pixels by ~8%"
  ],
  "editors_take": "Relying on connected components instead of projection profiles ensures more accurate text height measurements for larger fonts, preventing the overestimation errors that can disrupt the pre-OCR upscaling process.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}