Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Licence plate recognition using matlab programming


Published on

licence plate recognition using matlab programming

Published in: Engineering
  • Discover A Simple Holistic System For Curing Acne Once And For All using 100% Guaranteed All-Natural Method. Click Here ◆◆◆
    Are you sure you want to  Yes  No
    Your message goes here

Licence plate recognition using matlab programming

  1. 1. 1 CHAPTER-1 INTRODUCTION: 1.1 Objectives In today’s world, vehicles, especially cars, have been an important aspect in our life. All vehicles already have their identity displayed (the plate), therefore, many vehicles related application can be developed if the plate number can be recognize automatically. It can be used in applications like access control to a facility, data collection for the car plates that pass a toll road traffic Surveillance, car trapping, security , parking systems and other applications which the number plate of cars needs to be recognized. The LPR system significant advantage is that the system can keep an image record of the vehicle which is useful in order to fight crime and fraud ("an image is worth a thousand words"). This system is advanced in surveillance of cars in parking and at toll Plazas. This will automatically generate the number of a Vehicle and that can be used on the bills or may be to monitor the usage of the parking lot by a car. This system can be extremely useful for gathering statistics on road or at a check point for custom checking or to recognize a stolen vehicle. This system takes a vehicle image of any size breaks it into smaller image pieces. These pieces are then analyzed to locate the exact location of number plate in the image. Once the area of the number plate (its x and y coordinates) is found the plate is parsed to extract the character from it. These characters are then given to the OCR module. OCR program recognizes those characters and converts them in text format. The overall objective of the project is to develop a system to recognize vehicle license plate from a car at a gate entrance of a parking lot. The software could lead to a cheaper and faster way of enhancing and determined the performance of the recognition system. The system will be based on a Personal Computer such that it will generate report on the vehicle license plate it has captured. Once the vehicle license plate is captured, the characters will be recognized and displayed on the Graphical User Interface. Besides, the system can also serve as a security purpose whereby it can spot on any wanted or stolen vehicles. In the past, there has been similar project implemented but had poor accuracy. Thus, we would need to improve or rewrite the
  2. 2. 2 algorithm to improve the accuracy. I will address a set of constraints and focus on the design of the algorithm to extract the vehicle license plate in order to improve the accuracy. There is definitely a lot more room for further improvement on this project. However, due to the limited time frame given, it is not advisable for me to cover all aspects in this project. Thus, in discussion with my tutor, we managed to come up with the progress guideline as to what need to be included in this project. 1.2 Brief Descriptionof the Project Vehicle License Plate Recognition is an image processing system whereby it is used to recognize the vehicles by identifying the license plate. It is basically use for traffic and security purposes. 1.2.1 How the Vehicle License Plate System works a) Firstly, the vehicle will stop at the car gantry. b) Secondly, the front picture of the vehicle will be taken. The system will read the information pixels of the vehicle and run the recognition process c) Thirdly, the system will apply certain algorithm to analyses the vehicle image. Besides analyzing, the images will be enhance, locating the vehicle plate position and extract the characters from the vehicle plate. Next, the characters will be recognized by using Template matching. d) Lastly, the system will try to match the recognized vehicle plate number with the car plate database. If “authorized vehicle”, the gantry will open and allowed the vehicle to pass through. By the OCR processes.
  3. 3. 3 1.2.2 Optical Character Recognition (OCR): The exact mechanisms that allow humans to recognize objects are yet to be understood, but the three basic principles are already well known by scientists – integrity, purposefulness and adaptability. These principles constitute the core of OCR allowing it to replicate natural or human-like recognition. Optical Character Recognition provides machine vision functions we can use in an application to perform OCR. OCR is the process by which the machine vision software reads text and/or characters in an image. Optical Character Recognition (OCR) is a type of document image analysis where a scanned digital image that contains either machine printed or handwritten script is input into an OCR software engine and translating it into an editable machine readable digital text format (like ASCII text). OCR works by first pre-processing the digital page image into its smallest component parts with layout analysis to find text blocks, sentence/line blocks, word blocks and character blocks. Other features such as lines, graphics, photographs etc are recognized and discarded. The character blocks are then further broken down into components parts, pattern recognized and compared to the OCR engines large dictionary of characters from various fonts and languages. Once a likely match is made then this is recorded and a set of characters in the word block are recognized until all likely characters have been found for the word block. The word is then compared to the OCR engine’s large dictionary of complete words that exist for that language. These factors of characters and words recognized are the key to OCR accuracy by combining them the OCR engine can deliver much higher levels of accuracy. Modern OCR engines extend this accuracy through more sophisticated pre- processing of source digital images and better algorithms for fuzzy matching, sounds-like matching and grammatical measurements to more accurately establish word accuracy
  4. 4. 4 Fig. 1.1 Besides, the Vehicle License Plate Recognition also provide an advantage by keeping the image of the vehicle in which it will be useful for crime fighting. Camera can also focus on the face of the driver and save it for security reason. There are difficulties for Vehicle License Plate Recognition in which it will affect the efficiency and accuracy of the system. It is essential and important to determine the facts which will able to influence the operations and recognition proficiency. Next, we also need to look into other facts of variables that are not constant. Below are the non-constant variables which will affect the accuracy of recognition:  Speed of the vehicle  Weather condition  Type of Vehicle  Type of plate ( Rectangular, Bent type)  Vehicle license plate orientation  Type of vehicle fonts character
  5. 5. 5 1.3 Brief Descriptionof the MATLAB – TOOL 1.3.1 Introduction to MATLAB : MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy to-use environment where problems and solutions are expressed in familiar mathematical notation. 1.3.2 Important features of MATLAB: 1. MATLAB, which stands for Matrix Laboratory, is a product of The Math works, Inc. 2. MATLAB is a platform independent (meaning it should work equally well on a PC a MAC, or a mainframe system), interactive environment for computation, visualization, and animation. 3. MATLAB has a “natural language” interface that is easy to use. It also has built-in functions and toolboxes that help facilitate problem solution and graphical visualization of problems. 4. MATLAB is especially powerful in the solution of linear algebra (matrix) problems. 5. It is Case Sensitive. 1.3.3 Typical uses include: 1. Math and computation. 2. Algorithm development 3. Data acquisition. 4. Modeling, simulation, and prototyping. 5. Data analysis, exploration, and visualization 6. Application development, including graphical user interface building
  6. 6. 6 HOW DOES IT LOOK LIKE? Fig. 1.2 Matlab window
  7. 7. 7 1.3.4 MATLAB TOOLBOXES: There are some MATLAB reference functions which everyone have to gone through to learn MATLAB. These functions are given below according to their category:- 1.3.5 DesktopTools andDevelopment Environment : 1. exit: - terminates the current MATLAB session. 2. quit: - terminates the current MATLAB session. 3. clc:- Clear Command Window. 4. diary:-Save session to file. 5. format:- Use the format function to control the output format of numeric values displayed in the Command Window. • Format Default. Same as short • format short fixed point with 5 decimal places • format long fixed point with 15 decimal places • format short e Floating point with 5 decimal places • format long e Floating point with 15 decimal places • format short g Best of fixed or floating point with 5 DPs • format long g Best of fixed or floating point with 15 DPs • format hex Hexadecimal format • format compact Suppress extra line-feeds • format loose Put the extra line-feeds back in 6. clear:- removes all variables from the workspace. This frees up system memory. 7. help:- help lists all primary help topics in the Command Window. Each main help topic corresponds to a directory name on the MATLAB search path.
  8. 8. 8 A long list of help topics for which on-line help is available:- • help • helpwin -- open help window and show default help topics • helpdesk -- open first page of help window • demo -- open list of available demo in matlab 8. exist:-Check existence of variable, function, directory, or Java class. 9. cd:- Change current folder 10. dir:-Directory listing. 11. mkdir:-Make new directory. 12. what:-List MATLAB files in current directory. 13. edit: - opens a new editor window. 14. zeros: - returns an n-by-n matrix of zeros. It can take multidimensional values. 15. sparse:- converts a full matrix to sparse form by squeezing out any zero elements. 1.3.6 GRAPHICAL USER INTERFACE (GUI) A graphical user interface (GUI) is a graphical display that contains devices, or components, that enable a user to perform interactive tasks. To perform these tasks, the user of the GUI does not have to create a script or type commands at the command line. Often, the user does not have to know the details of the task at hand. The GUI components can be menus, toolbars, push buttons, radio buttons, list boxes, and sliders—just to name a few. In MATLAB, a GUI can also display data in tabular form or as plots, and can group related components.
  9. 9. 9 Working of GUI Each component, and the GUI itself, is associated with one or more user-written routines known as callbacks. The execution of each callback is triggered by a particular user action such as a button push, mouse click, selection of a menu item, or the cursor passing over a component. The creator of the GUI provides these callbacks. In the GUI, the user selects a data set from the pop-up menu, then clicks one of the plot type buttons. Clicking the button triggers the execution of a callback that plots the selected data in the axes. This kind of programming is often referred to as event-driven programming. The event in the example is a button click. In event-driven programming, callback execution is asynchronous, controlled by events external to the software. In the case of MATLAB GUIs, these events usually take the form of user interactions with the GUI. Techniques used to implement the GUI There are following two techniques to implement the GUIs in the MATLAB:- 1. Creating a Simple GUI with GUIDE. 2. Creating a Simple GUI Programmatically. GUIDE: a. A Brief Introduction: GUIDE, the MATLAB graphical user interface development environment, provides a set of tools for creating graphical user interfaces (GUIs). These tools simplify the process of lying out and programming GUIs.
  10. 10. 10 The GUIDE Layout Editor enables you to populate a GUI by clicking and dragging GUI components — such as buttons, text fields, sliders, axes, and so on — into the layout area. It also enables you to create menus and context menus for the GUI. b. GUIDE Tools Summary: Fig. 1.3 GUI Window
  11. 11. 11 c. Programming a GUI: When you save your GUI layout, GUIDE automatically generates an M-file that you can use to control how the GUI works. This M-file provides code to initialize the GUI and contains a framework for the GUI callbacks—the routines that execute in response to user-generated events such as a mouse click. Using the Mfile editor, you can add code to the callbacks to perform the functions you want. Programming a Simple GUI shows you what code to add to the example M-file to make the GUI work. d. Starting a GUIDE: There are many ways to start GUIDE. We can start GUIDE from the: 1. Command line by typing guide 2. Start menu by selecting MATLAB > GUIDE (GUI Builder 3. MATLAB File menu by selecting New > GUI 4. MATLAB toolbar by clicking the GUIDE button However we start GUIDE, it displays the GUIDE Quick Start dialog box shown in the following figure. Fig. 1.4 GUIDE Quick start
  12. 12. 12 e. Blank GUI: The blank GUI template displayed in the Layout Editor is shown in the following figure. Fig. 1.5 Blank Gui window Creating GUIs Programmatically i. Callback Execution: Callback execution is event driven and callbacks from different GUIs share the same event queue. In general, callbacks are triggered by user events such as a mouse click or key press. Because of this, you cannot predict, when a callback is requested, whether or not another callback is executing or, if one is, which callback it is.
  13. 13. 13 Various functions used in creating GUIs programmatically are given below:- ii. Predefined Dialog Boxes: a. errordlg:- Create and open error dialog box. b. uigetfile:-Open standard dialog box for retrieving files. c. uiopen:-Open file selection dialog box with appropriate file filters. d. warndlg:-Open warning dialog box. e. questdlg:-Create and open question dialog box. f. uisave:-Open standard dialog box for saving workspace variables. g. msgbox:-Create and open message box. h. uiputfile:-Open standard dialog box for saving files iii. Deploying User Interfaces: a) guidata:-Store or retrieve GUI data b) guihandles:-Create structure of handles. c) movegui:-Move GUI figure to specified location on screen. d) openfig:-Open new copy or raise existing copy of saved figure. iv. User Interface Objects: a) menu:-Generate menu of choices for user input. b) uibuttongroup:-Create container object to exclusively manage radio buttons and toggle buttons. c) uicontextmenu:-Create context menu. d) uicontrol:-Create user interface control object. e) uimenu:-Create menus on figure windows. f) uipanel:-Create panel container object. g) uipushtool:-Create push button on toolbar. h) uitoggletool:-Create toggle button on toolbar. i) uitoolbar:-Create toolbar on figure.
  14. 14. 14 CHAPTER-2 LITERATURE SURVEY Record keeping has always been a tedious job. Be it maintaining fees record of students or maintaining records of attendance or records of the library. All of these require high accuracy and a lot of manual work. Errors in these records are undesirable as these records are of high significance as they contain data of individuals. We decided to make a system that would help in reducing the manual work. At the beginning of our project, we thought of making a system which would simplify and reduce the manual work required in the opening and closing the gate. Books: i. The 8051 Microcontroller (Pearson education)by M.A. Mazidi for microcontroller pin configuration and function of each pin. ii. J.B. Gupta for basic study of electronic components and their behavior. iii. Rafael C. Gonzalez, Richard E. Woods and Steven L. Eddins, “Digital Image Processing using MATLAB” iv. Rafael C. Gonzalez and Richard E. Woods, “ International Edition Digital Image Processing Second Edition” Websites: i. ii. iii.
  15. 15. 15 CHAPTER-3 FLOW CHART: Detection Segmentation Recognition Fig. 3.1 Flow chart Web camera Image Acquisition Vertical Edge Detection Filtering Vertical Edge Matching Vertical Segmentation Horizontal Segmentation Character Number Template Matching Result
  16. 16. 16 3.1 Image Acquisition: Image acquisition is the first phase in license plate recognition process. Image can be acquired using an analog camera with a scanner or using a digital camera. Image acquisition through analog camera is impractical. The reliable and practical approach is acquiring images through digital camera. System performance can be improved by using a video camera with the frame grabber in real time applications. However, the proposed methodology in this research work uses a high resolution digital camera for this purpose. 3.2 License Plate Extraction: 3.2.1 Vertical Edge Detection: The anticipated methodology employs Sobel edge detector as it offers additional precise outcome. The Sobel edge detector utilizes a 3x3 mask, which is applied on the input image to provide the consequential edged image. This stage reduces algorithmic difficulty. If we can identify half of the vertical edges, four corners of the license plate can then be traced. 3.2.2 Filtering: In this pre-processing stage, filtering process is used for blurring and for noise reduction and thus resulting a more sharpen image. Blurring is used in the pre-processing step which involved in removing and cleaning up of small patches and details from the image prior to object extraction, bridging of gaps in curves and lines. Next, blurring with liner/non liner filter is able to achieve noise reduction. We can apply convention techniques such as softening and sharpening. In order to reduce the background noise, softening is often applied to the low pass filter and it will affect the image to become blurring.
  17. 17. 17 3.2.3 Vertical Edge Matching: In this phase the width to height ratio of license plate is exploited to match the vertical edges for locating the region of where there is a possibility of license plate. The objective of vertical edge matching is to locate the right pair of regions that comprises the license plate. This objective has been achieved by matching up the rectangular area’s width to height ratio between two vertical regions to the actual standard ratio of a license plate. 3.3 Character Segmentation: 3.3.1 Approach: Character segmentation is the procedure of extracting the characters and numbers from the license plate image. Diverse aspects make the character segmentation task complicated, like image noise, plate frame, space mark, plate’s rotation and light variance. A number of procedures have been proposed for character segmentation to overcome these aspects. proposes the vertical and horizontal scanning for character segmentation. In the present research, this scheme is utilized for indian license plates by identifying the first and last columns and rows. 3.3.2 Vertical Scanning: Vertical scanning method is employed to dig out each character from the image found on first and last column pixel. It looks into the image by pixel vertically from [0, 0] until [width, height] which is executed in column by column scanning. As the input image is a binary image that consists of 1 and 0 values, vertical scanning scheme is simple to be executed. The width between each first and last column will be computed. At last, every character or number will be slice to split it from the plate background. Each element will be stored in array separately for next horizontal scanning process.
  18. 18. 18 Fig. 3.2 (A) Car number image Fig. 3.2(B) Vertical Scanning Fig. 3.3(A) Car number image Fig. 3.3(B) Vertical Scanning 3.3.3 Horizontal Scanning: Once every element is saved separately in preceding step, horizontal scanning will identify the first and last rows of the image. The intention is to eradicate extra upper and lower region from the image. To conclude, the outcome of this process will be an image with full of character or number elements without any spare areas.
  19. 19. 19 Fig. 3.4 Horizontal Scanning 3.4 Character Recognition: After the segmentation of elements (characters and numbers), the final module in the recognition process is character recognition. In the last module, character recognition is done by utilizing template matching technique. 3.4.1 Template matching: In the final module, each segmented character from the previous module will be matched with the stored templates of the character. These stored templates consist of pixels. These pixels are termed as test point. There are two types of test point. One test point is called white test point and the other is termed as black test point. The white area of the character image from segmentation stage is tested by the white test point. Black test point is used to test the black area of the character image. The result of the test point is given by: Result = ∑Matched point ×100% _______________________ ∑Test point
  20. 20. 20 Matched Point = White test points fall in white pixel of the character image and black test points fall in the black pixel of the character image. A predefined value has been allocated for black test point (85%) and white test point (90%). The character will be matched if the result is larger than these predefined values. 3.4.2 Calculating the Match Point: To test the white area, the character image is ANDED with the white test point template. As for a binary image in MATLAB, the 1 represents white and 0 for black, so the area that is matched with test point will give the result of 1. Then the whole result matrix will be added together to obtain the total match point. Same is done for the black test point case. The only difference is the character image will be inverted first before ANDED with the black test point template. 3.5 Experimental Setup and Results: After all the modules have been developed, the whole system is setup for testing. The proposed algorithm has been designed in Matlab for recognition of Indian license plates. The observations are made on Sony vaio with i3 processor and 2GB RAM. The effectiveness of the proposed algorithm has been checked over a huge dataset maintained under various illumination conditions (dawn, sunshine, rain, back lighting, shadow, and nighttime) and environments (street, roadside, parking lot). The image to the system is a colored image of size 640X480 pixels. Images have been taken from real scene around UET TAXILA and at main entrance of a private company’s car parking. Experimental results shown in Figure 8 indicate that the proposed license plate algorithm is quite efficient.
  21. 21. 21 CHAPTER-4 BLOCK DIAGRAM 4.1 POWER SUPPLY SECTION: Fig. 4.1 Power suppy 4.2 MOTOR DRIVER SECTION: Fig. 4.2 Motor Driver section
  22. 22. 22 4.3 MICROCONTROLLER SECTION: Fig. 4.3 Microcontroller section
  23. 23. 23 4.4 SERIAL COMMUNICATION: Fig. 4.4 Serial Communication Section
  24. 24. 24 CHAPTER-5 5.1 ComponentList: i. IC’s: ii. Light Emitting Diodes (LED’s): iii. Diodes: iv. Zener Diodes: v. Crystal: vi. Electrolytic Capacitors: vii. Ceramic Capacitors:
  25. 25. 25 viii. Carbon Resistors (0.25W): ix. PCB: x. Misllenious: 5.2 DESCRIPTIONOF TOOLUSED: 5.2.1 LEDS: LEDs are produced in a variety of shapes and sizes. The 5 mm cylindrical package (red, fifth from the left) is the most common, estimated at 80% of world production.
  26. 26. 26 Fig. 5.1 LED The color of the plastic lens is often the same as the actual color of light emitted, but not always. For instance, purple plastic is often used for infrared LEDs, and most blue devices have clear housings. There are also LEDs in SMT packages, such as those found on blinkies and on cell phone keypads (not shown). The main types of LEDs are miniature, high power devices and custom designs such as alphanumeric or multi-color. 5.2.2 Capacitors: Fig. 5.2 Capacitor A capacitor is an electronic device that can store energy in the electric field between a pair of conductors (called "plates"). The process of storing energy in the capacitor is known as "charging", and involves electric charges of equal magnitude, but opposite polarity, building up on each plate
  27. 27. 27 a. Electrolytic capacitors: An electrolytic capacitor is a type of capacitor typically with a larger capacitance per unit volume than other types, making them valuable in relatively high-current and low-frequency electrical circuits. This is especially the case in power-supply filters, where they store charge needed to moderate output voltage and current fluctuations, in rectifier output, and especially in the absence of rechargeable batteries that can provide similar low-frequency current capacity. They are also widely used as coupling capacitors in circuits where AC should be conducted but DC should not; the large value of the capacitance allows them to pass very low frequencies. Axial (top) and radial (bottom) electrolytic capacitors b. Ceramic Capacitors: Fig. 5.3 Ceramic Capacitor A Ceramic Capacitor is a capacitor constructed of alternating layers of metal and ceramic, with the ceramic material acting as the dielectric. Depending on the dielectric, whether Class 1 or Class 2, the degree of temperature/capacity dependence varies. A ceramic capacitor often has (especially the class 2) high dissipation factor, high frequency coefficient of dissipation.
  28. 28. 28 5.2.3 Electric circuits : The electrons within dielectric molecules are influenced by the electric field, causing the molecules to rotate slightly from their equilibrium positions. The air gap is shown for clarity; in a real capacitor, the dielectric is in direct contact with the plates. Capacitors also allow AC current to flow and block DC current. a. DC sources : The dielectric between the plates is an insulator and blocks the flow of electrons. A steady current through a capacitor deposits electrons on one plate and removes the same quantity of electrons from the other plate. This process is commonly called 'charging' the capacitor. The current through the capacitor results in the separation of electric charge within the capacitor, which develops an electric field between the plates of the capacitor, equivalently, developing a voltage difference between the plates. This voltage V is directly proportional to the amount of charge separated Q. Since the current I through the capacitor is the rate at which charge Q is forced through the capacitor (dQ/dt), this can be expressed mathematically as:where I is the current flowing in the conventional direction measured in amperes, dV/dt is the time derivative of voltage measured in volts per second , and C is the capacitance in farads. For circuits with a constant (DC) voltage source and consisting of only resistors and capacitors, the voltage across the capacitor cannot exceed the voltage of the source. Thus, an equilibrium is reached where the voltage across the capacitor is constant and the current through the capacitor is zero. For this reason, it is commonly said that capacitors block DC. b. AC sources : The current through a capacitor due to an AC source reverses direction periodically. That is, the alternating current alternately charges the plates: first in one direction and then the other. With the exception of the instant that the current changes direction, the capacitor
  29. 29. 29 current is non-zero at all times during a cycle. For this reason, it is commonly said that capacitors "pass" AC. However, at no time do electrons actually cross between the plates, unless the dielectric breaks down. Such a situation would involve physical damage to the capacitor and likely to the circuit involved as well. Since the voltage across a capacitor is proportional to the integral of the current, as shown above, with sine waves in AC or signal circuits this results in a phase difference of 90 degrees, the current leading the voltage phase angle. It can be shown that the AC voltage across the capacitor is in quadrature with the alternating current through the capacitor. That is, the voltage and current are 'out-of-phase' by a quarter cycle. The amplitude of the voltage depends on the amplitude of the current divided by the product of the frequency the current with the capacitance, C. 5.2.4 Resistances : A resistor is a two-terminal electrical or electronic component that opposes an electric current by producing a voltage drop between its terminals in accordance with Ohm's law: The electrical resistance is equal to the voltage drop across the resistor divided by the current through the resistor while the temperature remains the same. Resistors are used as part of electrical networks and electronic circuits 5.2.5 Transformer: A transformer is a device that transfers electrical energy from one circuit to another through inductively coupled electrical conductors A changing current in the first circuit (the primary) creates a changing magnetic field; in turn, this magnetic field induces a changing voltage in the second circuit (the secondary). By adding a load to the secondary circuit, one can make current flow in the transformer, thus transferring energy from one circuit to the other. The secondary induced voltage VS, of an ideal transformer, is scaled from the primary VP by a factor equal to the ratio of the number of turns of wire in their respective windings:
  30. 30. 30 5.2.6 MICROCONTROLLER: Fig. 5.4 Microcontroller The P89V51RD2 is an 80C51 microcontroller with 64 kB Flash and 1024 bytes of data RAM. A key feature of the P89V51RD2 is its X2 mode option. The design engineer can choose to run the application with the conventional 80C51 clock rate (12 clocks per machine cycle) or select the X2 mode (6 clocks per machine cycle) to achieve twice the throughput at the same clock frequency. Another way to benefit from this feature is to keep the same performance by reducing the clock frequency by half, thusdramatically reducing the EMI. The Flash program memory supports both parallel programming and in serial In-System Programming (ISP). Parallel programming mode offers gang-programming at high speed, reducing programming costs and time to market. ISP allows a device to be reprogrammed in the end product under software control. The capability to field/update the application firmware makes a wide range of applications possible. The P89V51RD2 is also In-Application Programmable (IAP), allowing the Flash program memory to be reconfigured even while the application is running.
  31. 31. 31 5.2.7 L293D MotorDriver: Fig. 5.5 Motor driver One of the first realizations in robotics is that making something move isn’t an easy task. You simply can’t take a “brain” circuit and connect it to a motor and expect anything to happen. The motor will simply say “HAH!” at the puny output signal from the brains, and stay stationary. What the brain needs is an enforcer. Muscle. Something to convince the motor to do things the way the brains want it to be done. There are many ways to strengthen (”buffer”) a signal so it’s strong enough to drive a large load like a motor. Transistor H bridges circuit, buffer chips, and dedicated motor driving chips are all suitable candidates, with their own benefits and limitations. 5.2.8 LCD (16X2 Lines): The 2 line x 16 character LCD modules are available from a wide range of manufacturers. LCDs have become very popular over recent years for information display in many ‘smart’ appliances. They are usually controlled by microcontrollers. They make complicated equipment easier to operate. LCDs come in many shapes and sizes but the most common is the 16 character x 2 line display with no back light. It requires only 11 connections – eight bits for data (which can be reduced to four if necessary) and three control lines (we have only used two here). It runs off a 5V DC supply and only needs about 1mA of current. The display contrast can be varied by changing the voltage into pin 3 of the display, usually with a trimpot.
  32. 32. 32 Fig. 5 Fig. 5.6 LCD The full name name liquid crystal display is a 16*2 alphanumeric display. The main purpose of use of liquid crystal display is to show the result of our project. 5.2.9 DC MOTOR: A DC motor is design to run on electric power .two example of pure DC design are Michael Faraday’s homo polar motor ,and the ball bearing motor which is a novelty . by far the most common dc motor types are the brushed and brushless types , which use internal and external communication respectively to create an oscillating ac current from the DC sources so they are not purely DC machines in a strict sense. Fig. 5.7 DC Motor
  33. 33. 33 CHAPTER-6 6.1 SCHEMATIC DIAGRAM : Fig. 6.1 Schematic Diagram
  34. 34. 34 6.2 PCB LAYOUT: Fig. 6.2 LAY OUT
  35. 35. 35 CHAPTER-7 7.1 MATLAB CODE: function [fname1,fname2]=renot(im1,im2) imagen=imread(im1); % Read image imagen1=imread(im2); imshow(imagen); % Show image imshow(imagen1); title('INPUT IMAGE WITH NOISE') % Convert to gray scale if size(imagen,3)==3 %RGB image imagen=rgb2gray(imagen); end % Convert to BW threshold = graythresh(imagen); imagen =~im2bw(imagen,threshold);%Invert Image % Remove all object containing fewer than 30 pixels imagen = bwareaopen(imagen,30);%This is used to detect Text.
  36. 36. 36 %Storage matrix word from image word=[ ];%Number isme store hoga re=imagen; %Opens number.txt Number likhne k liye fid = fopen('number.txt', 'wt');% fid=fopen('filename','permission') % Load templates load templates global templates % Compute the number of letters in template file num_letras=size(templates,2); while 1 %Fcn 'lines' separate lines in text [fl re]=lines(re);%To extract all the lines f1 is the first line and re is the rest line. imgn=fl; % Label and count connected components [L Ne] = bwlabel(imgn);% Har Letter ko alag alag karne k liye for n=1:Ne [r,c] = find(L==n);%Loop for every letter
  37. 37. 37 % Extract letter n1=imgn(min(r):max(r),min(c):max(c)); % Resize letter (same size of template) img_r=imresize(n1,[42 24]); % Call fcn to convert image to text letter=read_letter(img_r,num_letras); % Letter concatenation word=[word letter]; end fprintf(fid,'%sn',word);%Write 'word' in text file. % Clear 'word' variable word=[ ]; %*When the sentences finish, breaks the loop if isempty(re) %See variable 're' in Fcn 'lines' break end end fclose(fid); winopen('number.txt') fname1='number.txt'; %%%%%%%%%%%%%%%% title('INPUT IMAGE WITH NOISE')
  38. 38. 38 % Convert to gray scale if size(imagen,3)==3 %RGB image imagen1=rgb2gray(imagen1); end % Convert to BW threshold = graythresh(imagen1); imagen1 =~im2bw(imagen1,threshold);%Invert Image % Remove all object containing fewer than 30 pixels imagen1 = bwareaopen(imagen1,30);%This is used to detect Text. %Storage matrix word from image word=[ ];%Number isme store hoga re=imagen1; %Opens number.txt Number likhne k liye fid = fopen('number1.txt', 'wt');% fid=fopen('filename','permission') % Load templates load templates
  39. 39. 39 global templates % Compute the number of letters in template file num_letras=size(templates,2); while 1 %Fcn 'lines' separate lines in text [fl re]=lines(re);%To extract all the lines f1 is the first line and re is the rest line. imgn=fl; % Label and count connected components [L Ne] = bwlabel(imgn);% Har Letter ko alag alag karne k liye for n=1:Ne [r,c] = find(L==n);%Loop for every letter % Extract letter n1=imgn(min(r):max(r),min(c):max(c)); % Resize letter (same size of template) img_r=imresize(n1,[42 24]); % Call fcn to convert image to text letter=read_letter(img_r,num_letras); % Letter concatenation word=[word letter]; end fprintf(fid,'%sn',word);%Write 'word' in text file. % Clear 'word' variable
  40. 40. 40 word=[ ]; %*When the sentences finish, breaks the loop if isempty(re) %See variable 're' in Fcn 'lines' break end end fclose(fid); winopen('number1.txt') fname2='number1.txt'; end %CREATE TEMPLATES %Letter A=imread('letters_numbersA.bmp');B=imread('letters_numbersB.bmp'); C=imread('letters_numbersC.bmp');D=imread('letters_numbersD.bmp'); E=imread('letters_numbersE.bmp');F=imread('letters_numbersF.bmp'); G=imread('letters_numbersG.bmp');H=imread('letters_numbersH.bmp'); I=imread('letters_numbersI.bmp');J=imread('letters_numbersJ.bmp'); K=imread('letters_numbersK.bmp');L=imread('letters_numbersL.bmp'); M=imread('letters_numbersM.bmp');N=imread('letters_numbersN.bmp'); O=imread('letters_numbersO.bmp');P=imread('letters_numbersP.bmp'); Q=imread('letters_numbersQ.bmp');R=imread('letters_numbersR.bmp');
  41. 41. 41 S=imread('letters_numbersS.bmp');T=imread('letters_numbersT.bmp'); U=imread('letters_numbersU.bmp');V=imread('letters_numbersV.bmp'); W=imread('letters_numbersW.bmp');X=imread('letters_numbersX.bmp'); Y=imread('letters_numbersY.bmp');Z=imread('letters_numbersZ.bmp'); %Number one=imread('letters_numbers1.bmp'); two=imread('letters_numbers2.bmp'); three=imread('letters_numbers3.bmp');four=imread('letters_numbers4.bmp'); five=imread('letters_numbers5.bmp'); six=imread('letters_numbers6.bmp'); seven=imread('letters_numbers7.bmp');eight=imread('letters_numbers8.bmp'); nine=imread('letters_numbers9.bmp'); zero=imread('letters_numbers0.bmp'); %*-*-*-*-*-*-*-*-*-*-*- letter=[A B C D E F G H I J K L M... N O P Q R S T U V W X Y Z]; number=[one two three four five... six seven eight nine zero]; character=[letter number]; templates=mat2cell(character,42,[24 24 24 24 24 24 24 ... 24 24 24 24 24 24 24 ... 24 24 24 24 24 24 24 ... 24 24 24 24 24 24 24 ... 24 24 24 24 24 24 24 24]); save ('templates','templates')
  42. 42. 42 clear all while(1) input('plz enter for processing-->>') vid=videoinput('winvideo',1); preview(vid); file = sprintf('%s%d.jpg','g',1); y=getsnapshot(vid); closepreview; clear vid; imwrite(y,file); %im3=imread('rajen1.jpg'); %imshow(im3) %im2='test.jpg'; %im2='test.txt' renot(im1,im2); fname1='number.txt'; fname2='number1.txt'; numcomp(fname1,fname2); close all end
  43. 43. 43 function motor(e) ser=serial('COM3'); fopen(ser); switch (e) case 13 disp('authorised person'),fprintf(ser,'A'); otherwise disp('unauthorised person'),fprintf(ser,'B'); end fclose(ser); end function [A] = numcomp(fname1, fname2, showchars) if nargin < 3 showchars = 40; end % Respect a fully qualified path if one is being given [pt1,nm1,xt1] = fileparts(fname1); if isempty(pt1) [pt1,nm1,xt1] = fileparts(fname1);
  44. 44. 44 end d1 = dir(fname1); [pt2,nm2,xt2] = fileparts(fname2); if isempty(pt2) [pt2,nm2,xt2] = fileparts(fname2); end d2 = dir(fname2); f1 = textread(fname1,'%s','delimiter','n','whitespace',''); f2 = textread(fname2,'%s','delimiter','n','whitespace',''); [a1,a2,score] = diffcode(f1,f2); % Construct a final version of the file for display % Skipped lines are indicated by "-----" blankLine = char(32*ones(1,showchars)); f1n = [{blankLine}; f1]; f2n = [{blankLine}; f2]; a1Final = cell(size(a1)); a1Final = f1n(a1+1); a2Final = cell(size(a2));
  45. 45. 45 a2Final = f2n(a2+1); a1Final; a2Final; %for n = 1: length(a1Final) % Increment counters here if isequal(a1Final{1}, a2Final{1}) if isequal(a1Final{2}, a2Final{2}) disp('Gate Open') motor(13); elseif ~isequal(a1Final{2}, a2Final{2}) disp('Gate Close') motor(2); end end if ~isequal(a1Final{1},a2Final{1}) disp('Gate Close') motor(2); end %end end function letter=read_letter(imagn,num_letras)
  46. 46. 46 % Computes the correlation between template and input image % and its output is a string containing the letter. % Size of 'imagn' must be 42 x 24 pixels global templates comp=[ ]; for n=1:num_letras sem=corr2(templates{1,n},imagn);%Calculate correlation between two comp=[comp sem]; end vd=find(comp==max(comp)); %*-*-*-*-*-*-*-*-*-*-*-*-*- if vd==1 letter='A'; elseif vd==2 letter='B'; elseif vd==3 letter='C'; elseif vd==4 letter='D'; elseif vd==5 letter='E'; elseif vd==6
  47. 47. 47 letter='F'; elseif vd==7 letter='G'; elseif vd==8 letter='H'; elseif vd==9 letter='I'; elseif vd==10 letter='J'; elseif vd==11 letter='K'; elseif vd==12 letter='L'; elseif vd==13 letter='M'; elseif vd==14 letter='N'; elseif vd==15 letter='O'; elseif vd==16 letter='P'; elseif vd==17
  48. 48. 48 letter='Q'; elseif vd==18 letter='R'; elseif vd==19 letter='S'; elseif vd==20 letter='T'; elseif vd==21 letter='U'; elseif vd==22 letter='V'; elseif vd==23 letter='W'; elseif vd==24 letter='X'; elseif vd==25 letter='Y'; elseif vd==26 letter='Z'; elseif vd==27 letter='1'; elseif vd==28
  49. 49. 49 letter='2'; elseif vd==29 letter='3'; elseif vd==30 letter='4'; elseif vd==31 letter='5'; elseif vd==32 letter='6'; elseif vd==33 letter='7'; elseif vd==34 letter='8'; elseif vd==35 letter='9'; else letter='0';
  50. 50. 50 7.2 Microcontroller Code: #include<reg51.h> sbit RS = P1^0;//lcd sbit E = P1^1; sbit m1 = P2^0; sbit m2 = P2^1; void delay(int time) { int r,s; for(r=0;r<=time;r++) { for(s=0;s<=1275;s++) } } int serial_rec() { while(RI==0); RI=0; return SBUF; } void lcdcmd(char cmd)
  51. 51. 51 { RS=0; // RW=0; E=1; P0=cmd; E=0; } void lcddat(char dat) { RS=1; //RW=0; E=1; P0=dat; E=0; } void lcdstart() { lcdcmd(0X30); delay(10); lcdcmd(0X38); delay(10); lcdcmd(0X0C);
  52. 52. 52 delay(10); lcdcmd(0X06); delay(10); lcdcmd(0X01); delay(10); } void lcddisplay(char location,char*d) { lcdcmd(0x80|location); delay(1); while(*d) { lcddat (*d++); } } void main() { char rec; lcdstart(); TMOD=0x20; TH1=0XFD;
  53. 53. 53 SCON=0X50; TR1=1; TI=1; lcddisplay(0x80,"licence plate"); lcddisplay(0x40,"Recognaition "); // lcdcmd(0x18); delay(200); while(1) { rec=serial_rec(); if(rec=='a') { lcddisplay(0x80,"Authorised "); lcddisplay(0x40,"person "); m1=1; m2=0; delay(400); m1=0; m2=0; delay(100); m1=0; m2=1;
  54. 54. 54 delay(400); m1=0; m2=0; delay(100); } if(rec=='b') { lcddisplay(0x80,"Unauthorised "); lcddisplay(0x40,"person "); m1=0; m2=0; delay(400); } } }
  56. 56. 56 CHAPTER-9 Future Scope & Application: 9.1 Future Scope: Though we have achieved an accuracy of 98% by optimizing various parameters, it is required that for the task as sensitive as tracking stolen vehicles and monitoring vehicles for homeland security an accuracy of 100% cannot be compromised with. Therefore to achieve this, further optimization is required. Also, the issues like stains, smudges, blurred regions & different font style and sizes are need to be taken care of. This work can be further extended to minimize the errors due to them. 9.2 Applications of LPR Systems : Vehicle license plate recognition is one form of automatic vehicle identification system. LPR systems are of considerable interest, because of their potential applications to areas such as highway electronic toll collection, automatic parking attendant, petrol station forecourt surveillance, speed limit enforcement, security, customer identification enabling personalized services, etc. Real time LPR plays a major role in automatic monitoring of traffic rules and maintaining law enforcement on public roads. This area is challenging because it requires an integration of many computer vision problem solvers, which include Object Detection and Character Recognition. The automatic identification of vehicles by the contents of their license plates is important in private transport applications. There are many applications of such recognition systems, some of them are discussed below. i. Law Enforcement : The plate number is used to produce a violation fine on speeding vehicles, illegal use of bus lanes, and detection of stolen or wanted vehicles. License plate recognition technology has gained popularity in security and traffic applications as it is based on the fact that all
  57. 57. 57 vehicles have a license plate and there is no need to install any additional tracking apparatus. The main advantage is that the system can store the image record for future references. The rear part of the vehicle is extracted off the filmed image and is given to the system for processing. The processed result is fed into the database as input. The violators can pay the fine online and can be presented with the image of the car as a proof along with the speeding information. ii. Parking : The LPR system is used to automatically enter pre-paid members and calculate parking fee for non-members (by comparing the exit and entry times). The car plate is recognized and stored and upon its exit the car plate is read again and the driver is charged for the duration of parking. iii. Automatic Toll Gates : Manual toll gates require the vehicle to stop and the driver to pay an appropriate tariff. In an automatic system the vehicle would no longer need to stop. As it passes the toll gate, it would be automatically classified in order to calculate the correct tariff. iv. Border Crossing: This application assists the registry of entry or exits to a country, and can be used to monitor the border crossings. Each vehicle information is registered into a central database and can be linked to additional information.
  58. 58. 58 v. Homeland Security: The LPR system’s ability to read strings of alpha-numeric characters and compare them instantaneously to Hot Lists allows a Command Center to organize and strategize efforts in reaction to the information captured. Fixed LPR systems, which can be mounted to bridges, gates and other high traffic areas, can help keep a tight watch on entire cities, ports, borders and other vulnerable areas. Every LPR camera is capturing critical data such as color photos, date and time stamps, as well as GPS coordinates on every vehicle that passes or is passed. This incredible database provides a wealth of clues and proof, which can greatly aid Law Enforcement with 1) Pattern recognition 2) Placing a suspect at a scene 3) Watch list development 4) Identifying witnesses
  59. 59. 59 CHAPTER-10 Conclusion: The development of the Vehicle license Plate Recognition System is quite successful implemented using MATLAB version 7 For this project, We have discuss with our tutor and have listed out the process report that needed to be done. 1) Read the color image into Matlab. 2) Analyze the cropped image in its red, green blue frames 3) Convert the image from RGB to HSV and analyze its Hue, Saturation and Value 4) Image enhancement by using Histogram Equalization 5) Image quantization by using thresholding 6) Noise Reduction 7) Extract each character and number from the image using segmentation techniques 8) Training of the neural network 9) Send the character and number to the neural network for recognition 10) Results is to be displayed in Mat lab 11) A GUI will be developed after the techniques have been tested. After much research, reading and mastering the skill of MATLAB, I am able to complete the above task and achieving good results on the recognition. Next, I have also proceed to the auto- detection which I have modified the existing algorithm in the extract Digit.m. When running the main.m file, it is able to detect and recognize some of the zoom in car vehicle license plate but fail on the image of cars with headlights.