B.Sc. Hons. in Software Engineering CW228 Design Manual Project Title: Number Plate f Recognition f Supervisor: Nigel Whyte __f Student ID: C00131013 f Student Name: Ronghua Ou f Date: January 13, 2011 f Table of Contents 1. Introduction ................................................................................................................................ 3 2. Architectural Design .................................................................................................................... 4 3. Interfaces Design......................................................................................................................... 6 3.1 GUI Design ........................................................................................................................ 6 3.2 Menu Design ..................................................................................................................... 7 4. Modular Design ........................................................................................................................... 8 4.1 Modular Design Overview ................................................................................................ 8 4.2 Module of grayscale ......................................................................................................... 9 4.2.1 Detailed description of ........................................................................................... 9 4.3 Module of Edge Detection .............................................................................................. 10 4.3.1 Detailed Description............................................................................................. 11 4.4 Module of Localization ................................................................................................... 11 4.4.1 Detailed description of ......................................................................................... 12 4.5 Module of Segmentation ................................................................................................ 12 4.5.1 Detailed Description............................................................................................. 13 4.6 Module of Character Segmentation ............................................................................... 14 4.6.1 Detailed Description............................................................................................. 14 5. Use case design ......................................................................................................................... 15 5.1 Brief Use Case ................................................................................................................. 15 5.2 System Sequence Diagram ............................................................................................. 17 5.3 Domain model diagram .................................................................................................. 19 6. Conclusions ............................................................................................................................... 20 2 1. Introduction The document presents designs in each part of the NPR system. The NPR system can read the registration number automatically from the number plate area in digital image and change the number into plain ASCII text. Because project doesn’t include the hardware part of NPR system, so this document only describes software design which including Architectural Design, Interfaces Design, and Modular Design. Architectural design describes relationship between layers and what each layer actually doing. Interfaces Design describes what GUI and other interface looks like, what each interface is the use for, how interfaces involve the specific algorithm they are related and the effect of each interface. Modular design describes what and how each module actually work, function and method they are use, input, output and details describes of each module. Conclusion reviews the main point of this design document. 3 2. Architectural Design NPR system has six layers which including GUI layer, gray scale layer, edge detection layer, localization layer, Segmentation layer and Recognition layer. GUI User Interface Original Image Import grayscale Grayscale Image Edge Detection Edge Detection Image GUI Number Plate Localization Retangle Image Character Segmentation Segmentation Image Character Recognition Figure 1 NPR system architectural Grayscale layer is a grayscale algorithm use for convert the imported color image from GUI into grayscale image. This layer accepts an original image and output a grayscale image for the next layer. 4 Edge detection layer is also an algorithm contains Gaussian smoothing algorithm to removes the noises from grayscale image first, then canny edge detection algorithm deal with the edge detect and output an edge image for next layer. In the next layer (Number plate localization), system looks for the number plate area from Edge detection image by moving a pre-defined slid window around the image. This kind of area contains the maximum numbers of white pixel then applies the isolated sub-image which contains the number plate area to the next layer. Character segmentation layer is used for separate every single character in the number plate area from the sub-image by using vertical projection algorithm and outputs a set of sub-images that contains single characters. Character recognition layer is final identifies the characters from each sub-images and output them into text format. 5 3. Interfaces Design 3.1 GUI Design Figure 2 user interface of NPR System As we can see in figure 2, there are two menus in the top, one main display panel in middle, three small display panels below the main panel and a status message bar in the bottom. The results of each step will display in each panel when the system running. 6 3.2 Menu Design Figure 3 menu of file There are three options in file menu (figure 3): open, run and exit. Open is use for user choosing and open the image they want to import. Run is use for running the system combine each step, not separate running and Exit is use for gently exit the system, not force click close button in the top right. Figure 4 menu of help Help menu contains the about menu item which including a user manual, version and copy right about the system. 7 4. Modular Design 4.1 Modular Design Overview NPR System Grayscale Number Plate Localization Canny Edge Detection Character Segmentation open image file Roughly Isolation Gaussian Smoothing Binarization Convert Color Image into Grayscale Plate Resizing Edge Detection Vertical Projection Character Recognition Grid Feature Method Figure 5 module design overview Figure 7 shows the level of each module. There are 5 main sub-modules in NPR System; they are grayscale module, canny edge detection module, number plate localization module, character segmentation module, and character recognition module. Details of each module are describe below. 8 4.2 Module of grayscale grayscale Convert original Image into Grayscale Open image Figure 6 modular design of grayscale module The grayscale sub-module has two steps: open image and grayscale. Image is opened for grayscale process to convert to a grayscale image. 4.2.1 Detailed description of Module name: open file Description: load an image file Input: image file (.jpg or .bmp) Main success scenario: 1) Click the Menu “File” in the menu bar. 2) Click the “Open” menu item. 3) The “file open” window pop-up, user can choose the directory, select the file, or type the file name into the “file name” text field. Click OK selected image will be loaded and displayed in the main panel of user interface. Extensions: if user chose a file which is not .jpg or .bmp type or typed a wrong file name, an error window will friendly appear. 9 Module name: convert color image into grayscale Description: convert the inputted image into grayscale format Input: original image Output: grayscale image Main success scenario: 1) Click once in the main panel which is displaying the original image in the middle of main interface. 2) Original image displayed in the main panel will be replace to grayscale image. 4.3 Module of Edge Detection Canny Edge Detection Gaussian smoothing Edge detection Figure 7 canny edge detection module Sub-module of canny edge detection contains two steps: Gaussian smoothing and Edge detection. Canny edge detection contains the Gaussian smoothing which can remove the noise of edge detection image. The grayscale image will be converted into edge detected form by canny edge detection algorithm. 10 4.3.1 Detailed Description Module name: Canny edge detection Description: it is a algorithm of edge detection to remove all the other pixels except the edges of objects in the image. Input: grayscale image Output: edge detected image Main success scenario: 1) Click the main panel by twice. 2) Canny edge detection algorithm will be involve on the grayscale image, including finding the edge strength by calculating the gradient of the image and remove all the other useless pixels of the image except edges. 3) The grayscale image displayed in the main panel will be replaced to the edge detected image. 4.4 Module of Localization Number Plate Localization Number Plate Isolation Resizing Figure 8 number plate localization module 11 4.4.1 Detailed description of Module name: number plate localization Description: localize the number plate area from the edge detected image Input: edge detected Image Output: sub-image of number plate area Main success scenario: 1) Click the main panel by three times. 2) Defined a slide search window moves around in the edge detected image to find the area that has most edge pixels, it will be the area of number plate. The slide window wills high light in the edge detected image. 3) Click the Localization panel. 4) Perform plate resizing algorithm to find the exact boundaries of number plate. 5) The isolated number plate sub-image will be displayed in the localization panel. 4.5 Module of Segmentation Character Segmentation Vertical Projection Binarization Figure 9 characte segmentation module Character segmentation has two steps: binarization and vertical projection. Number plate area that has been separated from the edge detected image will converted into black and white form 12 by perform Binarization algorithm in the module, then the vertical projection algorithm is used for separate single character of the number plate area. 4.5.1 Detailed Description Module name: character segmentation Description: Isolated number plate sub-image will be separated to several part and each part can be supposed to contains one character. Input: isolated number plate sub-image Output: a set of sub-image that contains a character. Main scenario: 1) Click the Segmentation panel. 2) Convert the number plate area sub-image that has been isolated in last step into binary image. 3) Involve vertical projection algorithm onto the binary sub-image to separate the single character. 4) The isolated single character sub-image will be displayed in the segmentation panel. 13 4.6 Module of Character Segmentation Character Recognition Grid Feature Method Figure 30 character recognition module Character recognition using an algorithm called grid feature method to identify the each subimage characters of number plate area and output them by text format. 4.6.1 Detailed Description Module name: character recognition Description: identify each character in number plate sub-image Input: a set of segmented sub-image Output: plate number in text form Main scenario: 1) Click the Recognition panel. 2) Apply grid feature method onto each segmented sub-image 3) The registration number on the number plate will be displayed in the recognition panel. 14 5. Use case design Figure 11 Use case diagram 5.1 Brief Use Case Use case: open image Actor: user Description: User chooses an image from hard disk. Then system open the image and display in main panel. 15 Use case: Image grayscale Actor: user Description: After import image, grayscale converts the original image into gray image. Gray image then replace the original image in main panel. Use case: Number plate localization Actor: user Description: A slide search window moves around in the edge detected image to find the area that has most edge pixels, it will be the area of number plate. The slide window wills high light in the edge detected image. The isolated number plate sub-image will be displayed in the localization panel. Use case: Number plate segmentation Actor: user Description: Number plate area that has been separated from the edge detected image will converted into black and white form, then separate single character of the number plate area. Use case: Number plate recognition Actor: user Description: identify the each sub-image characters of number plate area and output them by text format. 16 5.2 System Sequence Diagram Figure 12 Image grayscale use case of system sequence diagram Figure 13 Edge detection use case of system sequence diagram 17 Figure 14 Number plate localization use case of system sequence diagram Figure 15 Number plate segmentation use case of system sequence diagram 18 Figure 16 Number plate recognition use case of system sequence diagram 5.3 Domain model diagram Figure 17 Domain model diagram 19 6. Conclusions There are six layers in NPR system; they are GUI layer, gray scale layer, edge detection layer, localization layer, Segmentation layer and Recognition layer. User interface has two menus in the top, one main display panel in middle, three small display panels below the main panel and a status message bar in the bottom. The results of each step will display in each panel when the system running. NPR System contain five main modules, they are grayscale module, canny edge detection module, number plate localization module, character segmentation module, and character recognition module. Each module gets an input image or a set of sub-image from last module and outputs processed image to the next module. 20