Skip to content
Back to skills

Ocr Debug

ASecurity

Improve OCR accuracy — binarize, deskew, raise DPI, set language, fix contrast and noise

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 3, 2026
ai-agentsgogit

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add black141312/ada --skill ocr-debug --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ocr Debug?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ocr Debug
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/black141312-ocr-debug/badge)](https://www.skillsdirectory.com/skills/black141312-ocr-debug)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ocr-debug
description: Improve OCR accuracy — binarize, deskew, raise DPI, set language, fix contrast and noise
category: image
---

# OCR Debug

Reach for this when OCR output is garbled, missing text, or has frequent character errors, and you need to improve the input image rather than the engine.

1. Reproduce on the specific failing image and save the EXACT bitmap handed to the OCR engine (post-preprocessing) — OCR errors are usually caused by the preprocessed image, not the original.
2. Check effective resolution: OCR engines want ~300 DPI for body text. Upscale small/low-DPI scans before recognition; tiny text is the most common cause of garbage output.
3. Deskew and de-rotate: even a few degrees of skew wrecks line segmentation. Detect skew angle and rotate to horizontal; fix upside-down pages (orientation detection) too.
4. Improve contrast and binarize thoughtfully: convert to grayscale, then adaptive/Otsu threshold to clean black-on-white. Over-aggressive global thresholding erases faint strokes — compare adaptive vs Otsu on the sample.
5. Remove noise and background: despeckle, drop background gradients/watermarks, and crop to the text region so the engine isn't distracted by borders, photos, or table rules.
6. Set the right language and character set: wrong language model, or not restricting to a digit/uppercase whitelist when appropriate, causes systematic substitutions (O/0, l/1).
7. Measure: compare recognized text to ground truth (character error rate) before and after each change so you keep only steps that help.

## Rules
- Inspect the post-preprocessing bitmap the engine actually sees; that's where the accuracy is decided.
- Aim for ~300 DPI of text height; upscaling beats feeding tiny glyphs.
- Deskew and fix orientation before binarizing — skewed lines defeat segmentation.
- Over-binarizing erases thin strokes; tune threshold on the real sample, prefer adaptive for uneven lighting.
- Always set the correct language; constrain the charset when the domain allows (digits-only, etc.).

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.