The algorithm for extracting number plate can be summarized as:-
- 1.Capture image from webcam.
- 2.Store the captured image into a image file for further processing.
- 1.Identify the intensity of the image.
If image intensity = high Reduce intensity Else if intensity = low Increase intensity Else No change.2.Convert image into grayscale.
- 3.Calculate appropriate threshold value for the image.
- 4.Convert the image into binary image using the calculated threshold.
- 1.Fill small holes including numbers of Number plate so that number plate area will be large to isolate from figure. 2.Determine width and height of the image. 3.Scan each pixel of line counting number of white pixels in the following system,
If number of ‘white’ pixels < x; pixels become ‘black’ Else; no change If number of ‘white’ pixels > y; pixels become ‘black’ Else; no change The value of x and y may be changed according the image intensity and plate area.4. Use the step no. 3 for both horizontal and vertical direction.
- 5.Check number of possible areas.
- 6. Logically AND with binary image obtained at “Convert image into binary algorithm.
- 7.Crop the required area.
- 1.Filter the noise level present in the image.
- 2.Clip the plate area in such a way that only numbers of plate area extracted.
- 3.Separate each character from the plate.
- 1.Create the template file from the stored template images.
- 2.Resize image obtained from segmentation to the size of template.
- 3.Compare each character with the templates.
- 4.Store the best matched character.
- 1.Open a text file in write mode (append mode in case of the multiple records).
- 2.Store the character obtained from the number identification process to text file in given format.
- 3.Close the file
Pic 1:- Number plate that is to be extracted.
Open the main.m file in MATLAB.
Now run the main.m file in the MATLAB. It may prompt you to change the default directory. You can either change folder or Add to Path. Better change the directory.
You will get a messagebox showing the extracted number plate. Message box like this:-
The log file ( log.txt ) is maintained to keep track of the saved number plates ( which can be used in application level ). The log file content contains the number plate with the date saved.
In main.m there are certain lines which when commented can be used to see the step by step characters extraction.
Feel free to ask any queries if any problem occurred. I am using MATLAB 7.12.0 (R20011a) but it should work in all version.
Download the whole project here.
The project involving the number plate extraction :- ANPR(Automatic Number Plate Recognition) Using ALR(Automatic Line Tracking Robot).