Skip to content
Article

What Is OCR? How It Works, Use Cases and Limits

OCR turns the text in scanned documents into searchable data. How it works, how ICR and OMR differ from it, where it is used and where it falls short.

Oğuzhan Gerçek··6 min read
What Is OCR? How It Works, Use Cases and Limits

Short answer: OCR (optical character recognition) is the technology that converts the text in a scanned document, a photo or a PDF into machine-readable text: an invoice, an ID card or a contract on paper becomes data that can be copied, searched and passed into software. Classic OCR matches printed text character by character against patterns; ICR, which uses machine learning, reads handwriting too, and today's document processing systems go further by interpreting the recognized text and splitting it into fields (invoice number, amount, date). Its limit is accuracy: poor scans, handwriting and complex tables produce errors, which is why in enterprise workflows OCR output passes through a validation step.

What is OCR?

In IBM's definition, OCR is a technology that uses automated data extraction to quickly convert images of text into a machine-readable format; it is also called text recognition. To a computer, the image coming out of a scanner is just a picture made of pixels; OCR turns those pixels into letters, words and lines. The result can be an editable text file, a searchable PDF or fields written directly into an application.

How OCR works

The stages as IBM describes them:

  1. Image acquisition: The page is scanned and converted to a two-color (black-and-white) image; dark areas are treated as characters and light areas as background.
  2. Preprocessing: The image is cleaned up: skewed scans are straightened (deskewing), rules and boxes are removed, text regions are detected.
  3. Recognition: One of two methods is used. Pattern matching compares a character with the font samples the program was trained on and works best with the fonts it knows. Feature recognition applies rules to a character's features such as lines, corners and curves and takes over for fonts the program was not trained on.
  4. Layout recognition: Advanced systems divide the page into text blocks, tables and images, then split them into lines, words and characters.
  5. Postprocessing: The output is saved as an editable file or a PDF; some systems keep the original image together with the OCR text.

Modern engines use a neural network for the recognition step: according to the documentation of the open-source Tesseract engine, the engine introduced with version 4 is based on an LSTM neural network focused on line recognition.

OCR, OMR, ICR and IWR

In IBM's classification:

  • Simple OCR: Character-by-character pattern matching; limited to the fonts and languages it knows.
  • OMR (optical mark recognition): Recognizes marks such as checkboxes, filled bubbles, signatures, logos and watermarks; used on forms and exam sheets.
  • ICR (intelligent character recognition): Uses machine learning or deep learning; through repeated training it learns to read new forms, handwriting included.
  • IWR (intelligent word recognition): The next step after ICR; it recognizes a whole word in a single image instead of a character, which makes it faster.

Today OCR is the first link in a longer chain we call document understanding: as IBM also notes, computer vision, natural language processing and generative AI sit on top of OCR to classify the recognized text, split it into fields and summarize it. For document processing with large language models, see the LLM article.

Use cases

The examples IBM lists also show the industries: loan documents and bank statements in finance, patient records in healthcare, forms in insurance, invoices and receipts in logistics; indexing passports, license plates and business cards; check processing; automating data entry; making scanned archives searchable and preparing them for big data analysis; accessibility for visually impaired users. In enterprise practice three flows come up most often: moving supplier invoices into the accounting system, capturing ID and document details from customer applications, and converting a paper archive into a digital one.

Limits and accuracy

OCR output is bounded by scan quality: low resolution, skewed or crumpled pages, weak contrast and text over a stamp all produce errors. Handwriting is not simple OCR's territory; ICR is needed, and even there accuracy varies with the handwriting. Tables, multi-column pages and combined form fields strain layout recognition. Turkish needs a separate note: the engine has to run with Turkish language data, otherwise letters such as dotted and dotless i, ğ and ş are misread. That is why in enterprise workflows OCR output is not written straight into the record of truth; critical fields such as amounts and ID numbers are validated with rules (total checks, format checks), and pages with a low confidence score go to a person.

If the documents carry personal data, the OCR flow falls under KVKK as well: where ID copies are processed (your own server or a cloud service abroad), how long they are kept and who can access them must be defined from the start; fields that are not needed should not be read at all, and those that are should be limited to the purpose.

Tools

  • Tesseract: An open-source OCR engine under the Apache 2.0 license. According to its GitHub page, the engine was developed by Hewlett-Packard between 1985 and 1994, open-sourced in 2005 and developed by Google from 2006 to 2017; version 5 was released in November 2021. It supports more than 100 languages out of the box and can produce plain text, hOCR, PDF and TSV among other formats. It is used from the command line or as a library; free, but installation, preprocessing and maintenance are on you.
  • Cloud document services: The document analysis services of AWS, Microsoft Azure and Google Cloud add field extraction and table recognition on top of OCR; they are billed per page and the data is processed on the provider's infrastructure, which raises the residency question.
  • Enterprise document processing platforms: Combine OCR, classification, field extraction, a validation screen and ERP integration in one product; preferred when volume is high and document types are varied.

On the enterprise side

Which steps of a document processing flow are suited to automation is the subject of our process optimisation service; building and running document understanding systems that combine OCR with language models is on the AI stack engineering page.

Frequently asked questions

What does OCR stand for? Optical character recognition: the technology that converts the text in an image into text a computer can read.

How is OCR done? The document is scanned or photographed, handed to OCR software, and the output is taken as text or a searchable PDF. Phone scanning apps and PDF tools do this at the press of a button; at enterprise volume a flow of scanner, OCR engine and validation step is built.

Can OCR read handwriting? Simple OCR cannot. ICR, which uses machine learning, can read handwriting, but accuracy depends on how neat the writing is and on the training data; critical fields should pass through human review.

Is there OCR for Turkish? Yes. Most engines, Tesseract included, work with Turkish language data; what matters is running the engine with the Turkish setting, otherwise letters such as ı, i, ğ and ş are misread.

What is the difference between OCR and ICR? OCR matches printed characters against patterns; ICR is trained with machine learning and also recognizes handwriting and new forms. ICR counts as the intelligent version of OCR.

Are documents read with OCR subject to KVKK? If the document contains personal data, yes. Where the data is processed, how long it is kept and who can access it must be defined; fields that are not needed on ID copies should not be read.

Sources