Printed text in an ordinary office font is the hardest easy problem in industrial OCR. The character set files that ship with vision software — OCRA20, OCRA30, SEMIDOT — are OCR-A templates at two sizes plus one dot-matrix set, so a clean page of Arial decodes as noise or not at all. No downloadable 'standard font' file fixes this: a trained set bakes in the font, the size in pixels, the print contrast, the lighting and the working distance. You train your own set from the real print, in the conditions the line will run. This guide gives the numbers that decide success — samples per character, pixel height, gray-level contrast, exposure — a worked lens example, and the steps from raw images to a set you can trust.
Why the shipped sets never read Arial
Template OCR does not read letters the way a phone does. The tool segments the image into blobs, then scores each blob against stored reference shapes and picks the best match. OCRA20 and OCRA30 hold the OCR-A letterforms at two pixel sizes; SEMIDOT holds a semi-dot-matrix print. OCR-A survives in every vision package because the font was drawn in the late 1960s for machines, with strokes engineered to survive bad print — it is the odd one, not the norm. Arial and every proportional sans-serif on your labels share almost nothing with those shapes, so match scores sit below threshold and the tool returns nothing.
The same logic answers the download question. A character set file stores shapes at a pixel size, an edge sharpness and a polarity captured by one lens, one light and one working distance. Move any of those and the stored templates stop matching, which is why nobody ships a 'standard fonts' file that works. If you control the print, OCR font selection: pick typefaces machines read reliably explains which faces read best. If the print is Arial and stays Arial, train your own set from it — the same conclusion reached in USB camera OCR fails to read characters in LabVIEW: the set has to be trained in the tool that will run it.
What every training sample needs
The set is only as good as its worst sample, and three numbers decide whether a sample counts.
Character height. Aim for at least 15 pixels of cap height per character, with 20 to 30 pixels as the comfortable band, and at least 3 pixels of stroke width. Below 15 px the anti-aliased edge occupies most of the stroke, so the binarized shape shifts with every small exposure change. Minimum font size for OCR: why small text fails and how to fix it covers what to do when the print cannot be enlarged; a reader vendor's valid character image size for OCR guidance works from the same floors.
Contrast. Measure a line profile across the text: the gap between the ink mean and the background mean must be at least 50 gray levels on the 8-bit scale, and 100 or more is where training stops being fragile. Nothing saturated — if the paper sits above gray 250, turn the light down.
Stability. Lock exposure and gain before capturing anything; an auto-exposure loop moves the gray levels between samples and the trained set inherits that spread. Auto exposure vs iris control: which one the camera sets sorts out who owns what. Matte paper wants a flat diffuse field or a small dome; glossy laminate wants the light moved off the reflection axis or a polarizer, the same move described for OCR lighting on shiny cylinders.
Worked example: 3 mm Arial, 110 mm field of view
Take a label block 110 mm wide carrying Arial 12 pt print. One point is 0.353 mm, so the 12 pt em measures 4.24 mm and the cap height lands near 3.0 mm — the number everything below hangs on.
Sensor and pixels. A type-1-inch sensor measures about 12.8 × 9.6 mm. At 8.8 MP that is 122.9 mm² ÷ 8.8 million pixels = 13.9 µm² per pixel, so 3.7 µm square pixels.
Magnification and lens. Covering 110 mm with a 12.8 mm sensor width gives m = 12.8 / 110 = 0.116. With an 8.5 mm lens, WD = f × (1 + m) / m = 8.5 × 1.116 / 0.116 = 82 mm.
The lens focal length calculator runs this in both directions, and blister inspection working distance and field of view writes the same formula out for a second worked case.
What the text looks like. One pixel on the object covers 3.7 µm / 0.116 = 32 µm. The 3.0 mm cap height becomes 3000 / 32 = 94 px, and an Arial stem near 0.4 mm becomes about 12 px — both far above the 15 px and 3 px floors, so this rig trains comfortably and tolerates a worn print.
Exposure. The label runs at 50 mm/s on the belt. Half a pixel of blur is 16 µm, so exposure must stay under 16 µm ÷ 50 mm/s = 320 µs; set 250 µs and let the light provide the level, not the shutter.
Aperture. Depth of field ≈ 2 × N × c × (1 + m) / m² with c = 2 px = 7.5 µm. At f/5.6 that is 2 × 5.6 × 0.0075 × 1.116 / 0.0135 = 6.9 mm, about ±3.5 mm of label height — enough for a belt-held label under a side guide. The Airy disk at f/5.6 is 2.44 × 0.55 µm × 5.6 = 7.5 µm, exactly 2 px, so strokes stay crisp. Closing to f/8 roughly doubles the depth of field but grows the Airy disk to 10.7 µm ≈ 2.9 px and visibly softens the strokes you are training on, so stay at f/5.6. Aperture f-number and depth of field in machine vision cameras and Airy disk size and the diffraction limit go deeper on that trade.
The parts that match this math: the LS-SMC-0017 is an 8.8 MP smart camera with a 1-inch sensor, global shutter and a C-mount, and the LS-FFL-0602 is an 8.5 mm, 1-inch, 10 MP C-mount lens.
Build the character set in eight steps
- Freeze the rig first. Final lens, working distance, light, exposure and f-number, as computed above. Training does not survive swapping any of them afterwards.
- Capture 40 to 60 production images across the part-position spread you actually see. One image of a text block yields dozens of instances, so this usually lands every frequent character at 20 to 50 samples; count the rare letters and top them up from extra prints until each class holds at least 10.
- Hold every image to the sample floors before training: 15 px minimum cap height, 3 px stroke, 50 gray levels of ink-to-background separation. Reject outliers rather than train on them.
- Rectify orientation. If the print arrives rotated, deskew before teaching — read randomly rotated digits with OCR shows the order of operations, and rotated ROI OCR keeps the read region matched to the text.
- Teach the characters. Box each character, confirm its label, store the sample. Build your own OCR training data from cropped character images covers the cropping route when the tool will not box cleanly.
- Flood the confusables. Make sure 0/O, 1/I/l, 5/S, 8/B, 2/Z and rn/m each carry a full sample count; these pairs fail first, and OCR confusing similar characters lists the optics-level fixes.
- Save and export to the runtime tool, in the file format the runtime reads, not just the trainer. Format mismatches between trainer and reader show up as unloadable files, not bad reads — see OCR font file format errors for the failure mode.
- Test on images captured after training, never on the training set.
Two mistakes account for most dead sets: training under bench lighting and running under plant lighting, and training sharp but running with the focus ring a quarter-turn off. Both are caught by step 8's fresh-image test, and the fix is recapture, not more samples.
Prove the set before the line trusts it
Run 200 fresh images through the finished set and score per character. A 10-character code needs per-character accuracy of 99.9% to read 99.0% of codes (0.999^10 = 0.990); drop to 99.5% per character and the code read rate falls to 95.1% (0.995^10 = 0.951). That exponent is why one weak character class dominates your rejects. Fix the worst class first — usually with more samples or better contrast — then rerun. Release the set at 99% or better code reads on the held-out batch, and rerun the same batch whenever light, lens or belt speed changes. OCR trains but fails at runtime collects the settings behind the classic worked-on-the-bench, blank-on-the-line failure.
Choosing hardware when you start from zero
Three routes cover most printed-font jobs, ordered from most to least optical freedom:
| Specification | LS-SMC-0017 | MV-SC5060XM-08M-WBN | LS-CRD-0028 |
|---|---|---|---|
| Power supply | 12 V~24 V | 24 VDC | 24 V |
| Weight | <500 g | Approx. 370 g (0.8 lb.) | 280 g |
| Storage temperature | -30 to 60 °C | – | -30 to 70 °C |
| Sensor type | 1" CMOS | CMOS, rolling shutter | CMOS |
| Pixel size | 3.45 μm | 2 μm × 2 μm | 3.2 μm x 3.2 μm |
| Memory | SC: 2G (optional 4G) / SC(E): 4G | 8 GB | – |
| Sensor size | – | 1/2.4" | 1/1.7" |
| Resolution | – | 3200 × 1920 | 2560× 2048 px |
| Max. frame rate | – | 15 fps | 30 fps |
| Exposure time | – | 72 μs to 150 ms | 35 μs ~ 1 s |
| Data interface | – | Gigabit Ethernet (1000 Mbit/s) | Fast Ethernet (100 Mbit/s) |
| Digital I/O | – | 12-pin M12 connector provides power and I/O, including opto-isolated input × 3 (Line 0/1/2), opto-isolated output × 3 (Line 3/4/5), RS-232 × 1 | 3 non-isolated inputs, 3 non-isolated outputs, 1 RS-232 |
| Price | $1,359.00 | $1,629.00 | $920.00 |
Values as printed in each product's data sheet; open a part for its drawing and full specifications.
A C-mount camera plus a proper machine vision lens lets you hit an exact pixel height at an exact working distance, as in the worked example. A fixed-optics route such as the MV-SC5060XM-08M-WBN — 6 MP, mono, 8 mm focal length, M12-mount — is the fast answer when your text size already sits inside its field of view. And when you can change the mark, change it to a barcode: the LS-CRD-0028, a 2560 × 2048 reader doing 60 codes/s with an 8 mm lens, beats any OCR rig on robustness. Browse smart cameras for inspection on the device, or fixed code readers if the barcode option is open.
- Interface
- USB 2.0
- Resolution
- 6-10 MP
- Sensor format
- 1"
- Shutter
- Global
- Type
- Machine vision fixed
- Sensor format
- 1"
- Mount
- C-mount
- Resolution
- 6-10 MP
When full OCR is the wrong tool
If the string is fixed or nearly fixed — a date code that always carries the same format — skip reading and use verification. OCR vs OCV: character inspection for date and lot codes and OCR verify mode: checking printed text against an expected string cover matching against a known string, which tolerates worse print than free reading. If you own the printing, adding a barcode beside the text removes the problem entirely. If the surface is curved and shiny, fix the lighting before touching the character set. Only true free reading of unknown sans-serif text needs the trained set this guide builds.
Pre-training checklist
- Final lens, working distance, f-number, exposure and light frozen and locked.
- Cap height at least 15 px per character (20 to 30 px comfortable), stroke 3 px.
- Ink-to-background contrast at least 50 gray levels, nothing saturated.
- 40 to 60 production images spanning the real position and print spread.
- 20 to 50 samples per character, 10 minimum for rare letters.
- Confusable pairs (0/O, 1/I/l, 5/S, 8/B, 2/Z, rn/m) at full sample count.
- Set exported in the runtime tool's own file format.
- 200 held-out images scored, 99% or better code reads before release.
Questions
How many samples per character does OCR training need?
Plan on 20 to 50 samples per character, with 30 as a working target, and never fewer than 10 for a rare letter. Because one image of a text block contains dozens of instances, 40 to 60 production images usually supply the frequent classes. Count each class after capture and top up the thin ones from extra prints before you train.
Is there a downloadable character set for Arial or standard printed fonts?
No, and none can work: a character set file stores shapes at one pixel size, one contrast and one edge sharpness captured by a specific lens, light and working distance. OCR-A ships with vision software because that font was standardized for machine reading; Arial was not. Train your own set from your own print, under production conditions.
What pixel height should a character have for OCR training?
At least 15 pixels of cap height, with 20 to 30 pixels comfortable and at least 3 pixels of stroke width. In the worked example, 3.0 mm Arial at an 82 mm working distance through an 8.5 mm lens lands near 94 px per character, well clear of the floor. Divide your text height by the object-side pixel size to get yours.
Does OCR accuracy really depend on working distance?
Yes, through magnification and focus. In the worked example, moving the camera from 82 mm to 90 mm drops the character from about 94 px to about 84 px, an 11% size change the templates absorb only if the training spanned it. Lock the mount and keep the running pixel height within about ±20% of the training mean; beyond that, retrain.
What code read rate will a trained character set give?
Multiply, do not average: a 10-character code reads at 0.999^10 = 99.0% when per-character accuracy is 99.9%, but only 0.995^10 = 95.1% at 99.5%. Score 200 held-out images per character, fix the worst class first, and release the set at 99% or better code reads.
My trained character set file will not load in the runtime tool. Why?
Almost always a format or version mismatch between the training utility and the runtime reader: each expects its own file layout, and a set moved between them fails to parse rather than reading badly. Retrain, or export, in the tool that will actually read on the line, and keep that pairing fixed afterward.

