SShortSingh.
Back to feed

Connected components beat projection for estimating text height before OCR

0
·6 views

A pre-OCR check that decides whether to upscale a screenshot needs an estimate of text height in pixels, and two simple OpenCV methods were compared. On clean Chinese text both stayed within about 2 px of the true height up to 30 px, but above that projection ran slightly high, while on English projection measured the full line, around 1.37 times the cap height. On a bordered table screenshot projection returned 559 px against 23 px for connected components. Accuracy of two OCR recognizers falls sharply below roughly 12 px, so an estimator a few pixels off near that threshold can misclassify an image. These results come from deliberately clean, single-font samples on one Mac and do not cover compression, noise, or complex layouts.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Developer Automates Daily Google Calendar Screenshots Using Playwright, rclone and systemd

A developer built a workflow on Ubuntu to automatically capture a rolling seven-day view of Google Calendar as an image, rather than exporting event data through an API. The pipeline uses Python with Playwright to drive a headless Google Chrome browser, saves dated PNG files locally, and uploads them to Google Drive via rclone, all scheduled by a systemd user timer. The author found authentication the most challenging part, as Google rejected sign-in from Playwright's bundled Chromium, so a dedicated persistent Chrome profile was used instead. Sessions were reused successfully by launching both the manual sign-in and headless runs with the same Linux password-storage mode. The original workflow was tested on Ubuntu 22.04 with Playwright 1.48.0, while the public repository's generalized version has not been independently tested with a live account.

0
ProgrammingDEV Community ·

Developers Share Lessons From Building Fail-Closed Verification Tools for AI Agents

The author reports building two small open-source verification tools for the emerging AI agent economy, which share a rule: an unverifiable result should never be reported as clean. Al-Muqarin checks claims against signed, dated snapshots of public sanctions lists and returns a not-measured result when a list is missing, stale, or below a minimum version. agent-receipt-verify checks x402/EIP-712 payment receipts and reports incomplete ones as failures rather than passing them. The team tests its tools by planting deliberate bugs and confirming that tests catch each one, with Al-Muqarin catching all 548 planted faults. The authors acknowledge that other services already sign sanctions-screening results and that their tools have no paying users yet. They also disclose an unresolved weakness in a separate prototype, where the verifier identity field is free text and can be exploited.

0
ProgrammingDEV Community ·

Teks melingkar dibuat ulang dengan Python dan fontTools, membandingkan jarak antarhuruf

Tata letak teks melingkar yang terlihat rumit sebenarnya memposisikan setiap huruf di sepanjang busur dan memutarnya menghadap ke luar. Penulis menunjukkan cara meniru fitur Type on a Path di aplikasi desktop osFoundry dengan Python, menggunakan fontTools, numpy, dan Pillow. Dengan skrip tersebut, stempel KUMO COFFEE ROASTERS dibuat di atas lingkaran berdiameter 450,6 px. Hasil pengukuran memperlihatkan bahwa memutar huruf dengan sudut sama menghasilkan jarak tidak rata, dengan celah negatif di sekitar huruf lebar dan spasi antarkata yang menggelembung. Penulis juga membahas posisi teks rata tengah pada path tertutup bergantung pada titik awal.

0
ProgrammingDEV Community ·

Why multi-file C++ programs fail in online compilers and how to fix them

Many online C++ compilers accept only a single editor file, so a program split into a header and source file fails with a missing-header error. Pasting only the header does not help, because the member function definitions live in the .cpp file, which then triggers linker errors. The article explains that the program must compile and link all source files together. It shows an example Student class split across header and source files, and notes rules such as exact filename matching, folder support, and file limits on one platform. It also describes how to submit multiple files through an API using Python.