‘Optical Character Recognition’ – or OCR – is a process which allows us to convert text contained in images into editable documents. OCR can extract text from a scanned document or an image of a document; really, any image with text in it.
This technology is employed for a variety of applications, such as data entry of documents, automatic number plate recognition, digitisation of printed documents in Google Books, and even beating CAPTCHA anti-bot systems!
In the CAD world, OCR plays a crucial role in converting raster sketches into editable CAD drawings. In this article, we’ll go behind the scenes to understand how OCR works!
There are two different techniques (or algorithms) in optical character recognition: pattern recognition and feature extraction, and each technique is worth looking at in a little bit more detail.
Using this technique, the computer tries to recognize the entire character and matches it to the matrix of characters stored in the software. As a result, this technique is also known as pattern matching or matrix matching. The drawback of this technique is that it relies on the input characters and the stored characters being of the same font and same scale. Check out the photo on the left — it’s the first font created in the 1960s for OCR — the OCR-A — where every letter had the same width. All cheques were printed using this font to allow banking computers to process them!
Scan2CAD applies Neural Networks to the task of pattern matching. Neural networks work in an analogous way to the human brain. They learn to recognize shapes and patterns from a range of examples. Scan2CAD includes a feature allowing the user to train their own Neural Networks to recognize font styles unique to their drawings.
This one is a much more sophisticated way of spotting characters. It decomposes characters into “features” like lines, closed loops, line directions and intersections.
Let’s take letter A as an example. If the computer sees two angled lines that meet at the top, and both lines are joined together by a horizontal line in the middle, that’s a letter A.
By using rules like these, the program can identify most capital ‘A’s, regardless of the font that it is written in.
Pre-processing to improve text recognition
In order to recognize text effectively, the software must pre-process the image using techniques such as:
- De-skew – Titlting the image a few degrees in order to make the lines of text perfectly horizontal or vertical
- Despeckle – Removing spots and smoothing the edges of the characters
- Character isolation – Split touching characters that may have bled into each other
- Layout analysis – Identifying text positions, columns and paragraphs
- Line removal – Removing overlying lines or boxes
More sophisticated software conducts post-processing steps as well. The software would match the transcribed output to a lexicon (a dictionary of allowed characters), or conduct near-neighbor analysis to identify words that are usually seen together (for example, the phrase “living doom” will be automatically corrected to “living room”, since the word “living” and “room” often occur together).
OCR Technology in Scan2CAD
Scan2CAD is a raster-to-vector conversion engine. It converts images into vector drawings, so that it can be edited using other CAD/CAM and CNC software. Since many images contain text, OCR is a vital part of the raster-to-vector conversion process. Unlike many CAD image converters, Scan2CAD converts text in raster images into proper editable vector text strings, instead of constructing it out of individual vector entities (such as lines and arcs.)
You can help ensure that the text on your raster image is ready for vectorization by following Scan2CAD’s Raster Text Quality Checklist.
With OCR, there’s no need to manually retype the labels, and these text vectors are easily editable too. In many cases, all you have to do is click “OCR” on the ribbon at the top of your workspace, and voila! Try OCR for yourself using our 14-day FREE trial of Scan2CAD.
- Best practices for improving OCR accuracy
- Convert handwritten notes into Word documents
- Build your own OCR application using kNN