Optical Character Recognition (OCR) and License Plate Recognition

Table Of Content
Facebook
X
LinkedIn
Optical Character Recognition (OCR) and License Plate Recognition

Introduction: 

The OCR technique transforms documents like scanned documents, camera photographs, and other images into digitally interpretable and accessible data. For that reason, OCR techniques are used in license plate reading. The following are some commonly used OCR techniques for recognizing license plate numbers.

OCR techniques

Template matching:

The template matching technique starts with generating templates. A dataset belonging to a character that consists of that character’s unique images in different styles, fonts, lengths, and widths is used for every character. These images of nature are provided labels of that character and necessary preprocessing steps such as gray scaling and normalization are performed. This is how the templates are retained. An example of a template matching can be seen in Fig 1.1

Binary A

fig 1.1. A template of the letter ‘A’

Licence Plate Recognition Services

How is it performed:


The license plate images are preprocessed as well for any noise and other distortions. The difference between the contrasts of the regions of our interest on the number plate and other regions is maximized so that the detection is made easier. After the license plate and the characters on it are detected, the next is to segregate the characters so that each character is isolated. This process is called Character Segmentation. Once all these processes are done, the segmented characters are made to match the template characters. The match is done by comparing at the pixel level or other zone level on the image. If a match is found, the segmented image gets recognition.

Pros and Cons:


Template matching is among the simple techniques of OCR that can be used for License plate recognition. Template matching is easy to use as well as easy to explain. It is computationally less costly than other techniques. 

However, it is often not very accurate, particularly if the images are not of good quality. Another disadvantage is that it can be highly sensitive, especially in the case when there are a lot of characters and consequently, their templates, as seen in Fig 1.3.

Pros & Cons

fig 1.3. Different templates of digit 9

Traditional Machine Learning Methods:


This technique involves taking distinctive features of the characters such as edges, corners, lines, curves, etc., and using these features to make a match. There are several ways of extracting features like edge detection, contour detection, texture, or shape analysis.

Traditional Machine Learning Methods

fig 2.1. Feature extraction

Edges are detected using differences in the brightness of the image. Contour detection is about joining points of images together that have the same color. And to assist, each way has many helper algorithms. For example, for edge detection, Canny, Sobel, etc algorithms are used. For Contour detection, Freeman Chain code, or Peucker’s algorithm is helpful.

Feature Extraction

fig 2.2 Detection of edges and contour on a license number plate

Similarly, for texture and shape analysis, Local Binary Patterns and Fourier Descriptions can be used, respectively.

How is it performed:


The training data is prepared by providing correct labels to each sample and then trained for character recognition using a machine learning algorithm. Character recognition usually involves the segmentation of license plate images. Again, there are many ways to achieve it like thresholding and component analysis. The algorithm calculates the probability of each character, and the one with the highest probability is selected. The selected characters are concatenated to form the license plate. It is followed by other post-processing steps such as error detection and corrections.

Pros and Cons:
The approach of feature-based OCR has its share of advantages and disadvantages. For example, it offers end-to-end automation. It can recognize characters far better than the template-based OCR’s approach which usually does not perform well when the characters are partially distorted. Other than that, it also handles noisy data better than the former one. 

Its main disadvantages are that it requires a large dataset to be trained on. Human intervention is also very limited in the process of training. Other than that, it still may not perform better than the neural network-based approaches. 

Neural network-based methods:

This approach involves neural networks, that are usually more powerful than other machine learning algorithms. Machine learning algorithms require some human intervention such as feature selection and extraction. In contrast, Neural Networks do not require human intervention, select features on their own, and are capable of learning through their own errors. However, neural networks are part of deep learning, which essentially is a subset of machine learning. Therefore, the concepts are the same, except that deep learning is more advanced and complex than traditional machine learning.

An example of feature extraction by a neural network is illustrated in Figure 3.1.

Neural network-based methods

fig 3.1. A simple CNN performing extractions on its own.

Cnn Perfoming

fig 3.2. Schema of a multiple-layer CNN for OCR for license plate recognition

How is it performed:


The neural network-based approach has a similar starting point, the preprocessing of the data. The preprocessing is usually made up of Image resizing, Image normalization, data augmentation, noise removal, and Segmentation. Since deep learning is a part of Machine Learning, it shares concepts with the latter, and many machine learning processes could be replicated in deep learning as well. The data is labeled and split into the train, validation, and test sets. Once the data is ready, a neural network architecture can be chosen. There is a wide range of neural networks such as Multilayer Perceptron (MLP), Convolutional Neural Networks (CNN), Recurrent Neural Networks (RNN), Hidden Markov Models (HMM) etc. The neural network is trained with the right combinations of hyperparameters such as learning rate, optimizers, loss function, and performance evaluation metrics such as accuracy scores, recall, and precision with a goal to achieve high performance on the test set while avoiding overfitting.  

Pros and Cons:

The advantages of using a Neural Network-based approach include greater chances of achieving higher accuracy than other approaches. This approach can handle variations in the license plate images better than other approaches such as changes in lighting, camera angles, etc. The neural networks also do not require manual feature extraction. 

The disadvantages of this approach consist of higher computational costs, tendencies to overfit as well as difficulty to explain.

Licence Plate Recognition Services

References:

  1. http://azjhpc.com/issue6/doi.org.10.32010.26166127.2020.3.2.234.244.pdf
  2. https://moov.ai/en/blog/optical-character-recognition-ocr
  3. https://www.analyticsvidhya.com/blog/2021/03/edge-detection-extracting-the-edges-from-an-image/
  4. https://www.analyticsvidhya.com/blog/2021/03/edge-detection-extracting-the-edges-from-an-image/
  5. https://www.baeldung.com/cs/ocr
  6. https://www.semanticscholar.org/paper/Number-Plate-Detection-with-a-Multi-Convolutional-Gerber-Chung/e015047bace9d909de956a9f3db70ab64a57d6a5
  7. https://medium.com/hd-pro/applying-edge-detection-to-feature-extraction-and-pixel-integrity-2d39d9460842
What is OCR?

OCR stands for Optical Character Recognition. It is a technology that allows machines to identify and extract text from images or documents. OCR is used in a variety of applications, including scanning and digitizing documents, automated data entry, and machine translation.

How does OCR work?

OCR works by analyzing the visual characteristics of text and translating those patterns into machine-readable code. OCR software uses algorithms to identify letters, words, and other characters in an image or document, and then convert them into digital text that can be edited, searched, or analyzed.

What are the benefits of using OCR?

The main benefits of using OCR include increased efficiency, accuracy, and productivity. OCR enables faster and more accurate data entry, reduces manual labor, and makes it easier to search and analyze large amounts of text.

What is LPR?

LPR stands for License Plate Recognition. It is a technology that allows machines to automatically recognize and read license plate numbers from images or video footage. LPR is used in a variety of applications, including parking enforcement, toll collection, and law enforcement.

How does LPR work?

LPR works by using computer vision algorithms to analyze images or video footage and identify license plate numbers. The system captures an image of the license plate and uses OCR technology to extract the text, which can then be used for various purposes, such as identifying stolen vehicles or tracking traffic violations.

What are the benefits of using LPR?

The main benefits of using LPR include increased efficiency, accuracy, and security. LPR enables faster and more accurate identification of vehicles, reduces the need for manual checks and inspections, and enhances security by identifying suspicious or unauthorized vehicles.

What are some potential challenges with OCR and LPR?

One potential challenge with OCR is the accuracy of the software, which can be affected by factors such as image quality, font type, and language. Inaccurate OCR can lead to errors in data entry or analysis. Another challenge with LPR is privacy concerns, as the technology can be used to track individuals or monitor their movements.

How can businesses and organizations use OCR and LPR?

Businesses and organizations can use OCR and LPR in a variety of ways, such as automating data entry and analysis, improving customer service, and enhancing security. For example, OCR can be used to digitize documents and automate data entry, while LPR can be used to identify unauthorized vehicles in a secure facility or track toll violations on a highway.