It feels like it's been a while since I've highlighted an image processing kind of project. I saw this post from Oliver Bennet and I thought; a) that's cool b) that's creepy c) but still cool. :)
Oliver's post is great in that it starts simple and builds up to a complete working application...
This tutorial is about how to implement automated license plate recognition in C# using OCR (Optical Character Recognition). In this guide there are code examples, detailed information and illustrations in order to help to achieve success optical character recognition and in license plate detection in C#.
This documentation is built up from two major parts: the first part consists of a rather theoretical and general description of license plate recognition and the Computer Vision technology in order to implement the example successfully; while the second part is a more detailed and programming- oriented documentation.
Happy coding! :)
Part 1: Introduction to the technology
- What is Computer Vision
- What is OCR (Optical Character Recognition)
- What is ‘license plate recognition’ and how you can benefit from it
Part2: C# programming, implementation of the example
- Creating the C# code for OCR
- Implement GUI example
What is Computer Vision
What is OCR (Optical Character Recognition)
License plate detection
The license plate recognition is an extremely useful component of OCR. With the help of this function it becomes possible to make logistics automated or implement effective security monitoring. The LPR (license plate recognition) makes it possible to read the license number of different vehicles. Basically, the following happens: the pixels of the image (the digital one) are converted into an ASCII format of the license plate. (ASCII is an abbreviation which stands for the American Standard Code for Information Interchange. It is a scheme which responsible for character-encoding. The ASCII consists of 128 characters and it is based on English alphabet). With other words: the camera scans the area where a device is placed. There are cars from a quite huge distance and their license plates cannot be seen. The application is able to detect texts on digital surfaces/images (in this case, to detect texts on the license plates of the cars. (Figure 1.) This detection function is easy-to-use and extremely useful in the case of surveillance systems.
Part2: How to accomplish OCR in C#?
First, it is important to determine the needed environment and the tools and devices. As it was provided above it is recommended to download the Microsoft Visual Studio which is an integrated development environment and can be used for developing programs which are designed to operate on Windows operating systems. Microsoft Visual Studio can handle managed and native codes as well. Such as the other integrated development environments, the Microsoft Visual Studio has a code editor. Furthermore, you will find the download link of the Microsoft .NET Framework which will also be an essential part of the development. As you may know, this is a partly open source freeware software framework. To build up the solution you will need an USB camera which is mostly up to you which device you would like to use. Also, I shared the download link of the camera SDK which was used for the implementation.
Some people can say “Why would I implement OCR?” Well, there are several advantages of this function which may not come to one’s mind at first. First, in the case of long documents, it would be expensive to hire someone who may take the job to enter the whole amount. Secondly, it is also faster than manually typing the text. Finally, a more advanced software is able to recreate tables.
To sum up, a code is written here which is able to detect a text which is black, the thickness of the text is “3”, the color of the detection in green (Figure 2).
Implement GUI example
Now the code comes which stands for the interface, the GUI code. While reading this you are looking at the graphical user interface of your browser. It would be nice if your applications would also have one, right? :) Without the graphical user interface, it would be quite harsh to handle your application. A lot of commands and codes would have to be used which is more uncomfortable than create the GUI which will provide a clean and easy-to-use surface. The programming of the GUI takes place in the MainForm.Designer.cs class as the following:
After creating the GUI you will see something like this on your screen (Figure 3) :
After providing the necessary examples, codes and details this tutorial aims to help implementing the Optical Character Recognition (OCR) function in C#. In this tutorial everybody can find useful help in order to achieve success in the field of character recognition. After examining the examples you will be able to detect texts from digital images, you can determine the language of the detection and you will be able to modify the color and the thickness of the detected text. This solution can be useful for those who wish to develop surveillance systems or work on the field of logistics and wish to automatize the system. Moreover, this example can be used for security monitoring. A detailed part about the license plate recognition also can be found here.
Hope this tutorial will be helpful and please do not hesitate to use it and provide your opinion on it. Thank you for reading this! :)
Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.