CG

    Confidence Gated OCR

    by Talal Nafees

    1

    OCR accuracy is often ruined by noise and low-confidence guesses that pollute your data.

    Free

    Security scanned

    Works with the AI Agents you already use

    CG

    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

    FieldValue
    Statusok
    Extracted TextTOTAL $42.50 THANK YOU FOR YOUR BUSINESS
    Average Confidence94.2%
    Threshold Used85%
    Words Accepted8
    Words Dropped2 (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

    1. Inspect final_output_annotated.png in the output directory to verify the bounding boxes.
    2. If the dropped words are critical, rerun with --threshold 70.
    3. Check the stage_preprocessed.png if the text appears corrupted to adjust your lighting or scan resolution.

    final_output_annotated.png

    PNG · 1536×1024

    Generated

    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

    1. Validation verify the environment and Tesseract installation using the --check flag.
    2. Execution pass a local image path to scripts/ocr_pipeline.py with your desired --threshold and --output-dir.
    3. Extraction the script cleans the image, runs Tesseract, and separates accepted words from those below the confidence gate.
    4. Retrieval parse the generated result.json for the filtered text and review the final_output_annotated.png for 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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 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

    Terminal / Shell
    Read Files
    Write Files
    Listed4 days ago

    What's inside

    Frequently Asked Questions

    This skill provides a local OCR pipeline that cleans images using OpenCV before running text recognition. It uses a configurable confidence gate to automatically filter out low-certainty guesses, ensuring only high-quality data reaches your application without the hallucinations common in LLM-based vision.

    Beyond the extracted text, you receive a structured JSON file containing per-word confidence scores and bounding box coordinates. It also generates an annotated image that visually highlights exactly which words passed the confidence threshold and where they were located on the original file.

    This skill requires the Tesseract OCR executable to be available on your system path and uses Python 3.8 or newer with libraries like OpenCV, NumPy, and Pillow. It runs entirely locally, meaning no cloud accounts, API keys, or external internet access are required to process your data.

    The skill is designed for English printed text and supports common image formats like PNG, JPEG, BMP, and WebP. It does not support PDF or SVG files directly, and it is less reliable for handwriting or highly stylized fonts.

    You can ask your agent to extract, read, or digitize text from a specific image file. You can also specify a custom confidence threshold or a specific page segmentation mode if you are processing unique layouts like single lines or receipts.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse All Claude Skills.

    Free