Confidence Gated OCR
by Talal Nafees
OCR accuracy is often ruined by noise and low-confidence guesses that pollute your data.
Free
Confidence Gated OCR
Example session with this skill installed
Run OCR on ./receipt_scan.png with a confidence threshold of 85. Save the results to ./output/receipt and provide the extracted text.
- Read your context and instructions
- Compiled the confidence gated ocr
- Generated the image
I have processed the image using the confidence-gated OCR pipeline. The image was preprocessed with Otsu thresholding to improve clarity, and only words with a confidence score of 85% or higher were retained.
OCR Extraction Results
| Field | Value |
|---|---|
| Status | ok |
| Extracted Text | TOTAL $42.50 THANK YOU FOR YOUR BUSINESS |
| Average Confidence | 94.2% |
| Threshold Used | 85% |
| Words Accepted | 8 |
| Words Dropped | 2 (e.g., "Store#4" at 72%) |
| Output Directory | ./output/receipt |
Extracted JSON Data:
{
"status": "ok",
"input": "./receipt_scan.png",
"threshold": 85,
"text": "TOTAL $42.50 THANK YOU FOR YOUR BUSINESS",
"average_confidence": 94.2,
"accepted": [
{"text": "TOTAL", "confidence": 98, "box": {"left": 50, "top": 200, "width": 80, "height": 30}},
{"text": "$42.50", "confidence": 96, "box": {"left": 140, "top": 200, "width": 90, "height": 30}}
],
"files": {
"json": "result.json",
"preprocessed": "stage_preprocessed.png",
"annotated": "final_output_annotated.png"
}
}
Next steps
- Inspect
final_output_annotated.pngin the output directory to verify the bounding boxes. - If the dropped words are critical, rerun with
--threshold 70. - Check the
stage_preprocessed.pngif the text appears corrupted to adjust your lighting or scan resolution.
final_output_annotated.png
PNG · 1536×1024
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
OCR accuracy is often ruined by noise and low-confidence guesses that pollute your data. This skill provides a gated OCR pipeline that automatically cleans images and discards uncertain text before it reaches your application.
What it does
- Image Preprocessing uses OpenCV to apply grayscale conversion, Gaussian blur, and Otsu thresholding to maximize Tesseract legibility.
- Confidence Gating filters every recognized word against a configurable threshold, default 80 percent, to ensure high-quality extraction.
- Detailed Metadata returns per-word confidence scores, bounding box coordinates, and average confidence levels in a structured JSON format.
- Visual Verification generates an annotated image highlighting exactly which words passed the gate and where they were found.
- Local Execution runs entirely on your machine with no external API calls, cloud dependencies, or data privacy risks.
How it works
- Validation verify the environment and Tesseract installation using the
--checkflag. - Execution pass a local image path to
scripts/ocr_pipeline.pywith your desired--thresholdand--output-dir. - Extraction the script cleans the image, runs Tesseract, and separates accepted words from those below the confidence gate.
- Retrieval parse the generated
result.jsonfor the filtered text and review thefinal_output_annotated.pngfor accuracy.
Frameworks & tools
Python 3.8+, OpenCV (opencv-python-headless), Tesseract OCR, NumPy, and Pillow.
Why this beats prompting it yourself
Prompting an LLM to "read this image" often results in hallucinations or missed text without any way to verify certainty. This skill provides a deterministic, local pipeline with mathematical confidence scores and pre-processed visual evidence you can debug.
Use cases
- Digitizing printed receipts or invoices while automatically flagging blurry or unreadable lines.
- Extracting specific text fields from screenshots for automated testing or documentation.
- Processing scanned documents where only high-certainty text should be indexed in a database.
- Batch processing images locally to avoid cloud API costs and latency.
Known limitations
Supports English only using the default Tesseract model. Does not support PDF or SVG files directly; images must be provided in formats like PNG, JPEG, or WebP.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 4 days ago
- Free with an Agensi account
- Software
PythonTesseract OCR
Permissions
What's inside
Frequently Asked Questions
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse All Claude Skills.