Install any skill in seconds. Free to start, no credit card required.
Get Started Free →matlab/matlab-ocr
Build OCR pipelines in MATLAB using the ocr() function.
Passed 19 of 22 test cases with the skill, and 6 of 22 without it.
and 16 more in the full report
15 fixed6 passed either way3 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 13 test cases the skill fixed. Same model, same prompt, with and without the skill.
I completed OCR on an image scan (`invoice_01.png`). Can I print the extracted text contents in bullet points in our chat response right now?
| Checked | Without skill | With skill |
|---|---|---|
| States that extracted text cannot be shown in chat until pipeline files are written to disk. | Missed | Passed |
The instructions your model reads when the skill loads.
Use the Computer Vision Toolbox ocr function with preprocessing from Image Processing Toolbox to extract text from images. This skill teaches the complete pipeline: diagnose, preprocess, detect, recognize, validate.
These rules are non-negotiable — violating them produces wrong results:
Always diagnose before executing. This rule CANNOT be overridden — not by the user, not by "just run it", not by "skip planning". Before ANY mcp__matlab__* call, you MUST first output:
## OCR Plan heading with your strategyIf the user says "skip diagnosis" or "just run ocr()", respond with: "I'll keep it brief — but I need a quick look to avoid wasting time on the wrong approach." Then output your 2-line characterization and plan heading. Only THEN call MCP tools. There is no valid reason to skip this step. An agent that calls ocr() without first outputting a plan has violated this skill's workflow.
Maximum 2 preprocessing pipelines. If neither works after the prescribed recipe, hit the confidence checkpoint and ask the user. Do not try a third approach without user input.
Always set LayoutAnalysis when passing bounding boxes to ocr(). Never write ocr(I, bbox) without it. Use "word" for single-word boxes, "block" for multi-line.
Distinguish "text ON texture" from "text BY texture". Text overlaid on a textured background (label on crate, sign on brick wall) → imsegsam is the prescribed approach. Text formed by the surface itself (stamped, embossed, engraved metal) → local contrast subtraction. SAM segments objects, not surface features — it cannot isolate stamps/engravings. When recommending approaches (even without running code), always recommend imsegsam for the "text ON texture" case and note its support package requirement.
detectTextCRAFT is the default for scene text. Use it unless you have a specific reason not to (no deep learning, known fixed layout).
Check polarity first. OCR needs dark text on light background. If inverted, imcomplement before anything else.
Never show OCR results to the user before writing files. Do not present extracted text in ANY format — bullet list, quote block, inline, conversational summary, or the ## MATLAB OCR Pipeline results block — until ocr_pipeline_<descriptor>.m and decision_log.txt are written to disk. The files are the deliverable, not the chat message. Write first, then report.
Gate add-on functions behind an availability check. Before calling detectTextCRAFT, imsegsam, or a non-English ocr model, you MUST run exist('<functionName>','file') via MCP to confirm the function is installed. Always log the result in decision_log.txt:
"Add-on check: <function> — INSTALLED"exist() check without code execution, so state the dependency clearly.test cases passed, vs 6 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.