Sei sulla pagina 1di 85

VEHICLE REGISTRATION PLATE IDENTIFICATION SYSTEM

JASIHA NOR BINTI JAMALUDIN

A report submitted in partial fulfillment of the


requirements for the award of the degree of
Bachelor of Electrical Engineering (Telecommunication)

Faculty of Electrical Engineering


Universiti Teknologi Malaysia

MAY 2009

ii

iii

To my beloved father and mother,


Jamaludin bin Ibrahim and Hamidah binti Abu Bakar,
my siblings, relatives and friends.

iv

ACKNOWLEDGEMENT

Alhamdulillah, praise to Allah for without his guidance and blessing I will not
have been able to complete my final year project. Working on this project was a
valuable experience and many people have contributed towards my understanding and
thoughts in making it success. In particular, I wish to express my sincere appreciation to
my project supervisor, Dr. Yusri bin Md. Yunos for encouragement, guidance, critics
and friendship.

I would like to convey my deepest gratitude to my family for their support, love
and blessing. I am also very thankful to my friends who were always there by my side at
every moment. My sincere appreciation also extends to all of my course mate and
others who have provided assistance at various occasions. Their views and tips are
useful indeed.

ABSTRACT

The vehicle registration plate identification system aims the program that could
identify the characters that appear on a registration plate in Malaysia. Many types of
applications can be applied using this system which it used the extracted plate number
and optional images to create automated solutions for various problems. Amongst the
various application of this systems are likes parking, access control, tolling, traffic
control and also for marketing tool. This project involves the design of graphical user
interface (GUI) that was developed using Microsoft Visual C++ to carry out the
characters by using a combination of advanced algorithm such as digital image
processing technique for reduce the noise and to enhance the quality of image and
characters recognition that used to classify the character. The identification process was
done using the Pattern Matching and Normalized Cross Correlation algorithm. The
characters are matched with predefined font template and the correlation value is
calculated to get the result. The system is an offline system that will be executed using a
computer, thus the vehicle image are pre stored in the hard disk for objective of
identification.

vi

ABSTRAK

Sistem pengenalpastian plat pendaftaran kenderaan adalah satu aturcara yang


dicipta bagi membolehkan aksara-aksara pada plat pendaftaran di Malaysia dapat
dikenalpasti. Terdapat banyak aplikasi yang boleh dilaksanakan dengan menggunakan
sistem ini, dimana dengan menggunakan imej dan nombor pendaftaran kenderaan
penyelesaian kepada pelbagai masalah dapat diwujudkan. Antara aplikasi yang dapat
dilaksanakan menggunakan sistem ini adalah seperti tempat letak kenderaan, kawalan
kemasukan, tol, pengawalan trafik dan untuk pemasaran.

Projek ini melibatkan

rekacipta satu antaramuka grafik yang dibangunkan menggunakan Microsoft Visual


C++ bagi membolehkan aksara-aksara dikenalpasti dengan menggunakan gabungan
antara algoritma seperti teknik pemprosesan imej digital bagi mengurangkan noise dan
meningkatkan imej kualiti dan pengecaman aksara bagi pengkelasan aksara. Proses
pengenalpastian dilakukan dengan menggunakan kaedah Pattern Matching dan
algoritma Normalized Cross Correlation. Aksara- aksara ini dipadankan dengan rangkarangka huruf yang siap dibina dan bagi mendapatkan keputusan dan hasil, nilai korelasi
akan dikira.

Sistem ini adalah sistem yang berfungsi secara offline dengan

menggunakan komputer dan gambar- gambar kenderaan telah disimpan di cakera keras
komputer untuk tujuan pengenalpastian.

vii

TABLE OF CONTENT

CHAPTER

TITLE

DECLARATION

ii

DEDICATION

iii

ACKNOWLEDGEMENT

iv

ABSTRACT

ABSTRAK

vi

TABLE OF CONTENT

vii

LIST OF FIGURES

LIST OF SYMBOLS AND ABBREVIATIONS

xii

INTRODUCTION

1.1

Introduction

1.1.1

Vehicle Registration Plate Identification System

1.1.2

Overall System

1.2

PAGE

Application of a Vehicle Registration Plate Identification


System

1.3

Problem Statement

1.4

Project Objectives

1.5

Scope of Project

LITERATURE REVIEW

2.1

Introduction

2.2

Literature Review

viii
2.2.1

System

2.2.2

Vehicle License Plate Recognition System

2.2.3

Design of a Recognition System for Special

2.2.4
2.3

2.4

Vehicle License Plate and Container Identification

Malaysian Car Plate

Car License Plate Recognition System

Digital Image Processing

2.3.1

Image Smoothing

2.3.2

Image Sharpening

10

2.3.3

Threshold

10

2.3.4

Negation

11

Pattern Matching

11

SYSTEM DEVELOPMENT AND IMPLEMENTATION

13

3.1

System Requirement

13

3.1.1

Hardware Requirement

13

3.1.2

Software Requirement

14

3.1.2.1 Microsoft Visual C++

14

3.2

Flow Chart of System

15

3.3

System Design

17

3.3.1

Graphical User Interface (GUI) Design

17

3.3.2

Key Functions of the Interface

18

3.3.2.1 OnMouseMove Class

18

3.3.2.2 OnExit() Class

19

3.3.2.3 OnLoad() Class

19

3.3.2.4 OnSmooth() Class

20

3.3.2.5 OnSharp() Class

21

3.3.2.6 OnThres() Class

22

3.3.2.7 OnNegate() Class

23

3.3.2.8 OnSearch() Class

24

3.3.2.9 OnRecog() Class

25

ix
4

RESULTS AND ANALYSIS

27

4.1

Introduction

27

4.2

Results

27

4.3

4.2.1

Load Image

27

4.2.2

Smoothen Image

28

4.2.3

Sharpen Image

29

4.2.4

Threshold Image

29

4.2.5

Negate Image

30

4.2.6

Search Location

31

4.2.7

Recognize

31

Analysis

34

CONCLUSION

35

5.1

Conclusion

35

5.2

Limitation

36

5.3

Problem Faced

36

5.4

Recommendations

36

REFERENCES

38

APPENDIX A

39

LIST OF FIGURES

FIGURE NO.

TITLE

PAGE

1.1

Access Control System

2.1

Kernel (weight=9)

10

2.2

Kernel (weight=1)

10

3.1

Basic interface of a workspace in


Microsoft Visual C++

15

3.2

Flow chart of the system

16

3.3

Graphical User Interface (GUI) of the


system

3.4

18

Program routine for displaying mouse


location

18

3.5

Program routine for exiting the application 19

3.6

Program routine for load image

20

3.7

Subroutine for smoothing image process

21

3.8

High pass filter 3X3 kernel

22

3.9

Subroutine for sharpening image process

22

3.10

Subroutine for threshold image process

23

3.11

Subroutine for negate image process

23

3.12

Program for search image process

24

3.13

Templates for the alphabet K and S

25

3.14

Error Massage

26

4.1

Image is displayed on the GUI

28

4.2

Smoothen Image

28

4.3

Sharpen Image

29

xi
4.4

Threshold Image

30

4.5

Negated Image

30

4.6

Search Location Result

31

4.7

Recognize Result

32

xii

LIST OF SYMBOLS AND ABBREVIATIONS

GUI

Graphical User Interface

MFC

Microsoft Foundation Classes

MIL

Matrox Imaging Library

MSDN

Microsoft Developer Network

VRPI

Vehicle Registration Plate Identification

CHAPTER 1

INTRODUCTION

1.1

Introduction

In this chapter we will introduce about the vehicle registration plate identification
(VRPI) system and how it works.

1.1.1

Vehicle Registration Plate Identification System

The vehicle registration plate identification system is an image processing


technology used to identify vehicles by their registration plates. Concept of this
technology assumes that all vehicles already have the identity displayed which is the
registration plate itself. So, there is no need of additional transmitter or responder is
required to be installed on the vehicles. One of the vehicle registration plate
identification system advantages is that the system can keep an image record of the
vehicle which is very useful in order to fight crime and fraud. Besides that, an
additional camera can be use to focus on the driver face and save the image for security
reasons.

2
The vehicle registration plate identification system is also known in different
references as automatic vehicle identification (AVI), car plate recognition (CPR),
automatic number plate recognition (ANPR), car plate reader (CPR) and optical
character recognition (OCR) for cars. Since the vehicle registration plates are based on
different country standards, where it is usually different in form, shape or material.
Therefore this systems are followed the country specification and are only applied to the
country where they are installed and used. Some vehicle registration plates have
additional information written or attached to the plate, such as state identification as in
USA plates, province initials such as in China, vehicle type likes in Korea, country flag
as in Europe and many more. For most applications this additional information is not
required and is usually not recognized due to the complexity, variation or quality.

1.1.2

Overall System

Figure 1.1 shows how a typical access-control system works.

When vehicle come close to


the secured area, the loop
detector will sense the car
and its presence are signaled
to the VRPI unit.

The VRPI unit activates the


illumination and takes
pictures of vehicle include
the plate. The pixel
information is read by the
frame grabber.

3
The VRPI unit analyzes the
image, detects the plate
position and identifies the
fonts using special artificial
intelligence methods.

The VRPI unit will check if


the vehicle appears on a
predefined list of authorized
cars or not. If found the gate
will be open by activating its
relay.

After the authorized vehicle


enters and passes, the gate
will close and system waits
for the next vehicle.

Figure 1.1: Access Control System [1]

1.2

Application of a Vehicle Registration Plate Identification System

Many types of applications can be applied using the vehicle registration plate
identification system which it used the extracted plate number and optional images to
create automated solutions for various problems. Amongst the various application of
this systems are:

a. Parking
When the vehicle is entering a shopping center, the vehicle registration plate
is identify and stored. This registration plate number is used to automatically

4
enter pre-paid members and will calculate parking fee for non-members. The
registration plate will be read again when the vehicle was exit and parking
fee will be calculated by comparing the exit and entry times. The gate will
automatically open after payment of the charged.

b. Access Control
After being recognized the vehicle registration plate by the system, a gate
automatically will opens for authorized members in a secured area, thus
replacing or assisting the security guard. The events such as result, time and
image are logged on a database and could be used in the future as a reference
in case if something bad was happened at that area.

c. Tolling
When the vehicle enters the toll lane and presents a pass card, the vehicle
registration plate was read. The registration plate number is used to calculate
the travel fee in a toll-road, or can be used to double-check the ticket. The
information of the vehicle is get back from the database and will be
compared against the pass information.

d. Traffic control
The vehicles can be directed to different lanes according to their entry
permits classification either it is authorized, known visitors or unknown
vehicles for inquiry. The system effectively reduces traffic congestions such
as long waiting lines and it is also can reduces the security officers work
load.

e. Marketing Tool
The vehicle registration plate numbers may be used to compile a list of
frequent visitors for marketing purposes. Beside that, it can also be used to
build traffic profile, for example the frequency of entry verses the hour or
day.

5
1.3

Problem Statement

As a results living in developing country, the number of vehicles in Malaysia


was growth rapidly. So there is a need to improve existing systems for the identification
of vehicles. In the market, there has been a number of commercialized software that can
be used for identification of registration plate. However, it cannot be readily used in
Malaysia because Malaysian vehicles registration plate was differ in style and format as
was mention earlier. That is mean the system is unable to detect car plates assign for
taxis, as well as special types of car plate.

1.4

Project Objectives

The objectives of this project are to create a registration plate identification


system, where it capable to identify the characters on the vehicle registration plate.
Besides that, this system expectantly will able to display a registration plates correctly
with a very easy graphical user interface (GUI).

1.5

Scope of Project

The scope of the project is to develop an offline system for vehicle registration
plate identification system. A GUI was creating using Microsoft Visual C++ 6.0 to
perform the image processing process. Image processing techniques will be applied to
enhance the uploaded images include Pattern Matching and Normalized Cross
Correlation algorithm for identify the characters.

CHAPTER 2

LITERATURE REVIEW

2.1

Introduction

This chapter will discuss about researches had been done before this on
developing vehicle registration plate identification system and the image processing and
identification techniques used in this project.

2.2

Literature Review

Many researches had been done before this on developing vehicle registration
plate identification system where the researcher have to sacrifice their time and money
to make sure the design system a well implement and success. Some of their work are
reviewed and enlighten in this chapter.

7
2.2.1

Vehicle License Plate and Container Identification System

This project was done by Mohamad Rahmat bin Wahab [2]. This project was
using Blob Analysis method for identification of vehicles plate and container. The
computer capability and vision system in term of repaired processing time, accurate of
location and segmentation each of character can be increase using Blob Analysis
method. Besides that, regardless of any position, this system has the capability to
extract accurately each of character in the required image. Meanwhile, for characters
recognition, neural network techniques were used where this technique had been used
to refer to a network or circuit of biological neurons and using the Matrox Imaging
Library (MIL) and Borland C++ Builder3 interface of this system was built.

2.2.2

Vehicle License Plate Recognition System

This project was done by Lee Seow Sung [3]. An aim of this project is to
develop a program that can recognize the vehicle license plate in Malaysia. A program
developing is involves the design of software to carry out the vehicle license plate
characters by using a combination of advance algorithm such as digital image processing
technique that was be used to reduce the noise and enhance the image quality. Besides
that, feature extraction technique also be used to extract the significant features for each
character and the character recognition technique was used to classify the characters.
The software programming for this project was used the Visual C++ 6.0 programming
language and will be executed using a computer.

8
2.2.3

Design of a Recognition System for Special Malaysian Car Plate

This project was done by Anoop Sehgal A/L Paras Ram [4]. For this project,
window based software was develop using Microsoft Visual C++. The image was be
enhance by applied image processing techniques include techniques for gray level image
processing and stroke analysis was used for character recognition.

2.2.4

Car License Plate Recognition System

This project was done by Tava Manggai A/P Muthusamy [5]. This project was
developed to recognize the characters that appear on a license plate using Pattern
Matching and Normalized Cross Correlation algorithm. Pattern matching is a
recognition technique which it represent each class by a prototype pattern vector.
Template matching is one of the simplest pattern classification approaches. A template
is defined as an ideal representation of the object to be identified within the image. This
process involves moving the template to every position in the image and evaluating a
degree of similarity at each position called the correlation. Meanwhile, the Normalized
Cross Correlation algorithm can be formulated directly in terms of images and is quite
intuitive. The result where are alphabets from A to Z will display in the interface
created using Microsoft Visual C++.

2.3

Digital Image Processing

Digital image processing is the use of computer algorithms to perform image


processing on digital images. As a subfield of digital signal processing, digital image
processing has many advantages over analog image processing; it allows a much wider
range of algorithms to be applied to the input data, and can avoid problems such as the

9
build-up of noise and signal distortion during processing [6]. Image enhancement is the
most interesting parts of digital image processing. Enhancement program will make
information more visible and few techniques such as smoothing; sharpening, threshold
and negation were used to achieve the target.

2.3.1

Image Smoothing

The process of image smoothing is used for blurring purpose or to remove


unwanted noise from an image while at the same time preserving the entire essential
details of image that observer would wish to see in original image. It is often to apply a
low pass filter to the input image in order to allow the low spatial frequencies to pass
through while attenuating the high spatial frequencies of the noise component. This is
because image noise generally manifests itself as random fluctuations in gray- level
values superimposed and it usually has a high spatial frequency [7].

The filtering operation can be implemented by convolving the entire image with
a simple 3X3 window or mask. The output of this technique is simply the average of the
pixels contained in the neighborhood of the filter mask. The filter mask was used for
reduction of irrelevant detail in an image where the irrelevant detail means that pixel
regions that are small with respect to the size of the filter mask. Figure 2.1 shows a 3X3
kernel for performing a low pas filter operation and smoothed value for each pixel may
be defined as:

R=

1 9
zi
9 i =1

(2.1)

10

Figure 2.1: Kernel (weight=9)

2.3.2

Image Sharpening

Image sharpening is another process to emphasize or strengthen the edges within


the image. This is achieved by using a high pass filter that modifying pixels data in the
region of edge. Figure 2.2 shows a common high pass kernel where this filter will
preserve the high frequencies component of the signal but will attenuate the low
frequencies where it is equivalent to eliminating any constant background intensity.

-1

-1

-1

-1

-1

-1

-1

-1

Figure 2.2: Kernel (weight=1)

2.3.3

Threshold

Threshold technique must be done to converts the grey scaled image into binary
image so it can be segmented into foreground and background region. Binary images
are much simpler to analyze because the geometrical patterns and objects in the images
can be identified easily since they are not cluttered with shading information.

11
Selection of the threshold value, T is a crucial issue where this value will not be
suitable for all image. It is common to study the image histogram in order to determine
the value that used to partition the image into pixels with just two values:
If f ( x, y ) T then g (x, y ) = 1

(2.2)

If f ( x, y ) < T then g ( x, y ) = 0

(2.3)

where g ( x, y ) denotes the binarised version of f ( x, y )

2.3.4

Negation

Negation is a simple process of inverting colors of a threshold image where black


and white is inverted vise versa. By subtracting the stored pixel value from the
maximum grey- level value that being used; this process can simply to be attained.

2.4

Pattern Matching

Identification technique based on pattern matching denotes each class by a


prototype pattern vector. An unknown pattern is allocated to the class to which it is
closest in terms of a predefined metric.

Pattern matching technique was used as the characters identify where it is the act
of checking for the presence of the constituents of a given pattern. This technique is
used to test and find whether things have a desired or relevant structure, to retrieve the
aligning parts, and to substitute the matching part with something else [8]. Template
matching that also known as pattern matching can be applied whether on binary or grey
level image.

12

The best match will have the higher matching function value when using the
normalized cross correlation algorithm. If P( x, y ) is the image, T ( x, y ) is the template,
then the matching function S (P, T ) will return a value to indicate how much the image
matches with the template.

S (P, T ) = P (i, j )T (i, j )


i =0 j = 0

(2.4)

CHAPTER 3

SYSTEM DEVELOPMENT AND IMPLEMENTATION

3.1

System Requirement

In developing a well and good system, the selection of the right hardware and
software is very important to make sure that there is no wasted time and money. In
additional, this also to ensure that the system that will be built can will function
effectively up to the user and developers requirement.

3.1.1

Hardware Requirement

The system for this project was developed using a personal computer with the
specification as below:

Intel (R) Pentium (R) M processor 725

256 MB DDR2 RAM (support dual- channel)

A digital camera was used to take the sample image of vehicle registration plate.
Then, these images were stored manually in the hard disk of the computer.

14
3.1.2

Software Requirement

The Microsoft Visual C++ is one of the software that will be used in developing
this system. This software will be the focus of discussion since it played the bigger role
in this project. Besides, Paint application was also used for image resizing to ensure the
original image does not get damaged.

3.1.2.1 Microsoft Visual C++

Microsoft Visual C++ is a high level programming language also graphical user
interface software that helps develop C++ codes on computers. This software was chose
because it is simple, secure, portable and user friendly. Compared to the other software,
all the coding required to produce an interface has been predefined already and make
writing programming become more easy and fast.

Microsoft Visual C++ provides various applications and Microsoft Foundation


Classes (MFC) Executable application was used for this project. The concept of object
oriented programming was used in MFC which it will provides an object oriented
framework in order to develop a windows application. The definition and operate of all
classes are described in a library called Microsoft Developer Network (MSDN).

The AppWizard generate a basic framework for the windows program which
already complete and executable. The classes generated by AppWizard are extending as
part of the basic windows program by the Class Wizard. It is also helps to add new
classes based on classes in the MFC to make sure the functionality needed in the
program was support. Figure 3.1 shows the basic interface of a workspace in Microsoft
Visual C++.

15

Figure 3.1: Basic interface of a workspace in Microsoft Visual C++

3.2

Flow Chart of System

The flow of the system used in identifying the vehicle registration plate is shown
in the figure 3.2. The flow chart shows the main flow of the vehicle registration plate
identifying system. All the vehicle images available for identifying are manually stored
in the hard disk. Therefore, the user of this system can choose an image from the
available pre stored images. Then, the image will be displayed on the interface of the
system after the selection.

Next, the preprocessing techniques such as smoothen, sharpen, threshold and


negate image will applied to enhance the selective image. Then, the location of the first
black pixel in the image will be located indicating the beginning of the identifying

16
process. The Pattern Matching will do the identifying and correlation value will be
calculated. If the value is above 0.7, identifying result will be display and if it is
opposite, error massage will be display.

Start

Negate
Image

Load Image

Search for 1st


black color pixel

Smoothen

Pattern Matching

Image

Sharpen
Image

& Calculate
Correlation

No

Yes
Correlation
> 0.7

Threshold
Image

Display Error in
Identification

Display
Result

End
Figure 3.2: Flow chart of the system

17
3.3

System Design

3.3.1

Graphical User Interface (GUI) Design

The Dialog Based application that was provides by MFC Application Wizard
(exe) was select to develop system and create GUI for this project [9]. This application
generates three classes which are CAboutDlg, CvrpiApp and CVrpiDlg and the main
class that was used is CVrpiDlg. Functions such as icons, buttons and edit boxes were
simply taken from the control toolbar provided as the first step to create the GUI and
using the Class Wizard all these functions are defined and were given their own
variables.

The GUI for this project is shown in the figure 3.3. At the left space of interface,
using the picture function it was provided for displaying image of the vehicle after the
successful of loading image process. Then, three edit boxes was arrange below the
display image area. These edit boxes were name as Location to display the location of
the mouse cursor throughout the whole image interface, Character Location to display
the location of the first black pixel found in image and Plate No. to display the result of
this system.

At the right space of the interface, eight buttons was provided to do some process
in order to functional the system. First button is Load Image button to allow image
that are pre stored from the hard disk to be loaded into the system. This follow by
Smoothen Image and Sharpen Image buttons to enhance and remove the noise in the
image loaded. Next are Threshold Image and Negate Image buttons that will
transformed image into only black and white image and then negated by inverting those
two color vise versa. The Search Location button was used to search the location of
the first black pixel in the image and Recognize button does the recognition process for
this system. Finally, the Exit button will function to close window of the system after
the requesting for a confirmation.

18

Figure 3.3: Graphical User Interface (GUI) of the system

3.3.2

Key Functions of the Interface

3.3.2.1 OnMouseMove Class

A routine is created to read the position of the mouse where the location of the
mouse is pointed and will display in the edit box IDC_LOCATION. Figure 3.4 shows
the routine for this mouse control.

void CVrpiDlg::OnMouseMove(UINT nFlags, CPoint point)


{
CString str;
str.Format("(%d,%d)",point.x-30,point.y-35);
SetDlgItemText(IDC_LOCATION,str);
CDialog::OnMouseMove(nFlags, point);
}
Figure 3.4: Program routine for displaying mouse location

19
3.3.2.2 OnExit() Class

This class is used to enable the user to close the window of application. A single
function call within the OnExit function closes the window and exits the application
after get the confirmation from the user. The class for the OnExit function is shown in
figure 3.5.

void CVrpiDlg::OnExit()
{
int Exit=MessageBox("Are you sure you want to exit this program?","Exit
Program",MB_YESNO+MB_ICONQUESTION);
if(Exit==IDYES)
{
OnOK();
}
}
Figure 3.5: Program routine for exiting the application

3.3.2.3 OnLoad() Class

This class allows the user to load bitmaps from files that are manually stored in
the hard disk. When the user clicked the Load Image button, a Load Image Dialog
window is pop up, allowing the user to select image of the registration plate where files
of bitmap format only are available to be displayed. The routine for the OnLoad() Class
is shown in figure 3.6.

20
void CVrpiDlg::OnLoad()
{
CClientDC dc(this);
CString m_sFileName, FileExt;
char szFilter []="Bitmap Files(*.bmp)|*.bmp||";
CFileDialog
m_ldFile(TRUE,/*DefFileExt*/NULL,NULL,OFN_HIDEREADONLY|OFN_OVERW
RITEPROMPT,szFilter,NULL);
if (m_ldFile.DoModal()==IDOK)
{
m_sFileName=m_ldFile.GetFileName();
UpdateData (FALSE);
FileExt=m_ldFile.GetFileExt();
FileExt.MakeUpper();
CDC dcMem;
BITMAP bm;
m_hBmpNew =
(HBITMAP)::LoadImage(AfxGetInstanceHandle(),m_sFileName,IMAGE_BITMAP,0,
0, LR_LOADFROMFILE|LR_CREATEDIBSECTION);
GetObject(m_hBmpNew,sizeof(BITMAP),&bm);
dcMem.CreateCompatibleDC(NULL);
::SelectObject(dcMem.m_hDC,m_hBmpNew);
dc.StretchBlt(30,35,350,220,&dcMem,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);
}
m_cSmooth.EnableWindow(TRUE);
}
Figure 3.6: Program routine for load image

3.3.2.4 OnSmooth() Class

This class is created to eliminate and remove noise in the image by applying a
low pass kernel. The output of this process is the average of the pixels in the
neighborhood of the filter mask where the bitmap is scanned at the first place. Then, all
the neighborhood pixel values are added together and are divided by 9. This process

21
will continue until the whole image is scanned and the coding was written as shown in
figure 3.7

for(y=0;y<=Height;y++)
{
for(x=0;x<=Width;x++)
{
a[0]=sourceDC.GetPixel(x-1,y-1)&0x000000ff;
a[1]=sourceDC.GetPixel(x-1,y)&0x000000ff;
a[2]=sourceDC.GetPixel(x-1,y+1)&0x000000ff;
a[3]=sourceDC.GetPixel(x,y-1)&0x000000ff;
a[4]=sourceDC.GetPixel(x,y)&0x000000ff;
a[5]=sourceDC.GetPixel(x,y+1)&0x000000ff;
a[6]=sourceDC.GetPixel(x+1,y-1)&0x000000ff;
a[7]=sourceDC.GetPixel(x+1,y)&0x000000ff;
a[8]=sourceDC.GetPixel(x+1,y+1)&0x000000ff;
value=(float)1/9*(a[0] + a[1] + a[2] + a[3] + a[4] + a[5] + a[6] + a[7] + a[8]);
if(value>255)value=255;
if(value<0)value=0;
result=(int)value + ((int)value<<8) + ((int)value<<16);
smoothDC.SetPixel(x,y,result);
}
}
Figure 3.7: Subroutine for smoothing image process

3.3.2.5 OnSharp() Class

The high pass filter 3X3 kernel was applied to perform the sharpening process as
shown in figure 3.8. In order to obtain image with edges and boundaries sharpened, the
kernel was applying each time the image was scanned start from the top left corner to
the right and from top to the bottom. The subroutine for the sharpening function is
shown in figure 3.9

22

1/7

-1

-2

-1

-2

19

-2

-1

-2

-1

Figure 3.8: High pass filter 3X3 kernel


for(y=0;y<=Height;y++)
{
for(x=0;x<=Width;x++)
{
a[0]=sourceDC.GetPixel(x-1,y-1)&0x000000ff;
a[1]=sourceDC.GetPixel(x-1,y)&0x000000ff;
a[2]=sourceDC.GetPixel(x-1,y+1)&0x000000ff;
a[3]=sourceDC.GetPixel(x,y-1)&0x000000ff;
a[4]=sourceDC.GetPixel(x,y)&0x000000ff;
a[5]=sourceDC.GetPixel(x,y+1)&0x000000ff;
a[6]=sourceDC.GetPixel(x+1,y-1)&0x000000ff;
a[7]=sourceDC.GetPixel(x+1,y)&0x000000ff;
a[8]=sourceDC.GetPixel(x+1,y+1)&0x000000ff;
value=(float)1/7*(-a[0] - 2*a[1] - a[2] - 2*a[3] + 19*a[4] - 2*a[5] - a[6] - 2*a[7] - a[8]);
if(value>255)value=255;
if(value<0)value=0;
result=(int)value + ((int)value<<8) + ((int)value<<16);
sharpDC.SetPixel(x,y,result);
}
}
Figure 3.9: Subroutine for sharpening image process

3.3.2.6 OnThres() Class

The threshold image function is used to converts the grey scale image into a
black (0) and white (255) image or binary image to make further analysis be easier. The
threshold value T for this project is predefined as 185 as in figure 3.10. Every pixel in
the image will be scanned and all values that exceed the threshold value T, will be set to
white and if it not, it will be set to black.

23
for(y=0;y<=Height;y++)
{
for(x=0;x<=Width;x++)
{
r[x][y]=sourceDC.GetPixel(x,y)&0x000000ff;
if(r[x][y]<=180) r[x][y]=0;
if(r[x][y]>180) r[x][y]=255;
if(r[x][y]>255) r[x][y]=255;
if(r[x][y]<0) r[x][y]=0;
result=((int)r[x][y]) + ((int)r[x][y]<<8) + ((int)r[x][y]<<16);
binarizeDC.SetPixel(x,y,result);
}
}
Figure 3.10: Subroutine for threshold image process

3.3.2.7 OnNegate() Class

This class is used to invert the pixel value in the threshold image that is to
change black pixel to white pixel and vise versa. The image is negated to make sure that
the characters of the vehicle registration plate are in black color so it easier for recognize
process. Figure 3.11 shows the subroutine for the negate process.
for(y=0;y<=Height;y++)
{
for(x=0;x<=Width;x++)
{
negateDC.SetPixel(x,y,0x00ffffff-(sourceDC.GetPixel(x,y)));
}
}
Figure 3.11: Subroutine for negate image process

24
3.3.2.8 OnSearch() Class

The OnSearch() Class scans the image to find the location of the first black pixel
in the image. The process is important for recognition process where this location state
the place that recognition process should be start and will be display in the character
location edit box.

Usually, the scanning image will start from the center of the Y- axis to make the
processing faster. This is because the registration plate is normally placed at the bottom
of the image and so that users have to make sure that registration plate have to be below
this position in order to be recognized. The program for this purpose is shown in figure
3.12.

do
{
for(x=0;x<Width;x++)
{
z=sourceDC.GetPixel(x,y)&0x000000ff;
if(z==0)
{
m=x;
locX=("%d",m);
n=y;
locY=("%d",n);
UpdateData(FALSE);
break;
}
}
y--;
}
while(z!=0);
Figure 3.12: Program for search image process

25
3.3.2.9 OnRecog() Class

The identification of the vehicle registration plate characters used the template
matching technique. At the first place, the arrays of templates for the characters A to Z
and 0 to 9 are created. The size of the templates are varies depending on the characters
and it have created in binary format. The example of the templates is shown in figure
3.13. For this example, 0 denotes the black color pixel and 1 denotes white color
pixel and the values of black and white pixels value are storing into arrays named
CHAR_K[20][16] and CHAR_S[20][14] respectively.
int CHAR_K[20][16]={0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,
0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,1,
0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,1,
0,0,0,0,1,1,1,1,1,0,0,0,0,1,1,1,
0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
0,0,0,0,1,1,1,0,0,0,0,1,1,1,1,1,
0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,
0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,1,
0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,
0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,
0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,
0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,
0,0,0,0,1,1,1,0,0,0,0,1,1,1,1,1,
0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,
0,0,0,0,1,1,1,1,1,0,0,0,0,1,1,1,
0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,1,
0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,1,
0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,1,
0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,
0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0};
int CHAR_S[20][14]={1,1,1,0,0,0,0,0,0,0,0,1,1,1,
1,1,0,0,0,0,0,0,0,0,0,0,1,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,1,
0,0,0,0,0,1,1,1,1,0,0,0,0,0,
0,0,0,0,1,1,1,1,1,1,0,0,0,0,
0,0,0,0,1,1,1,1,1,1,0,0,0,0,
0,0,0,0,0,1,1,1,1,1,1,1,1,1,
0,0,0,0,0,0,1,1,1,1,1,1,1,1,
1,0,0,0,0,0,0,1,1,1,1,1,1,1,
1,1,0,0,0,0,0,0,0,0,1,1,1,1,
1,1,1,1,1,0,0,0,0,0,0,0,1,1,
1,1,1,1,1,1,1,0,0,0,0,0,0,1,
1,1,1,1,1,1,1,1,1,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,0,0,0,0,
0,0,0,0,1,1,1,1,1,1,0,0,0,0,
0,0,0,0,1,1,1,1,1,1,0,0,0,0,
0,0,0,0,0,1,1,1,1,0,0,0,0,0,
1,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,1,0,0,0,0,0,0,0,0,0,0,1,1,
1,1,1,0,0,0,0,0,0,0,0,1,1,1};

Figure 3.13: Templates for the alphabet K and S

26

The black and white pixel value of the character from the image is stored first in
an array. Then the array is matched with all the defined templates and the percentage of
matchness is stored in a variable. As the Cross Correlation technique is used, the largest
value for correlation is the most likely match. The high correlation indicates that the
template is similar to the bitmap character and that the array will be set as the recognized
alphabet. The cross correlation value is calculated as:
Cross Correlation = Total Match
Template size

(3.1)

If the correlation value is less than 0.7, an error message will be displayed as
shown in figure 3.14. Meanwhile for the successful recognized, the result will be
displayed in Plate No. edit box. The successful result must have correlation value not
less than 0.7. 0.7 was chose as the level value to determine whether the system is
success or not because this value can make a better comparison and also not so difficult
to achieve as user want to see many successfully recognition.

Figure 3.14: Error Massage

CHAPTER 4

RESULTS AND ANALYSIS

4.1

Introduction

In this chapter, the result for all process in order to get the recognition of the
vehicle registration plate will be shown and displayed.

4.2

Results

4.2.1

Load Image

All the images captured using the digital camera was in 2048 x 1536 sizes.
Then, these images be resized to size of 350 x 220 to fit in the interface of the system
and were saved in bitmap format, *.bmp as the image of bitmap format only are allowed
to be loaded. Figure 4.1 shows the image displayed as a result of load image.

28

Figure 4.1: Image is displayed on the GUI

4.2.2

Smoothen Image

Smoothen image function will eliminate and remove noise in the image and give
a result of blurring process as shown in figure 4.2.

Figure 4.2: Smoothen Image

29
4.2.3

Sharpen Image

Sharpen image process do the similar function as smoothen process where to


remove the noise. If it notice carefully, the characters of the vehicle registration plate
will become clearer after this function as shown in figure 4.3.

Figure 4.3: Sharpen Image

4.2.4

Threshold Image

The threshold image function converts the grey scale image into a black (0) and
white (255) image. From the figure 4.4, it can be observed that characters of the vehicle
registration plate are still in white color whereas other colors in the image turn to black.

30

Figure 4.4: Threshold Image

4.2.5

Negate Image
Negate image function is a simple process of inverting colors of a threshold

image where black and white is inverted vise versa. The characters of the vehicle
registration plate now are in black color as shown in figure 4.5.

Figure 4.5: Negated Image

31
4.2.6

Search Location
The search location is function to find the location of the first black pixel in the

image. As shown in figure 4.6, when the location is found it will be displayed at the
character location box. This location can be verified by comparing it with the result at
the location box by moving the cursor to the spot where the characters begin.

Figure 4.6: Search Location Result

4.2.7

Recognize

The identification does the pattern matching starting from the location shown in
search location result. When the characters of the vehicle registration plate were
successfully identify, the result will be displayed in plate number box as shown in figure
4.7. Figure 4.7 also shows the recognize result for the other vehicle registration plate
after loading image till search location give a good result.

32

(a)

(b)

33

(c)

(d)
Figure 4.7: Recognize Result

34
4.3

Analysis
The accuracy for this system on identifying characters is not high as the

expectation. Only one over seven characters was success to recognize where it will give
the accuracy of the system only at 14%. So, lots of improvements have to be done in the
future to get more accurate result.

The accuracy of the system on identifying characters can be improved by using


images with a higher resolution. The higher resolution will make system much easier to
do identify the characters because there is not too much information was lost during the
enhancement process.

CHAPTER 5

CONCLUSION

5.1

Conclusion

This project has demonstrated the capability of pattern matching in identify the
characters that appear on a registration plate in Malaysia. A functional and user friendly
system which is able to enhance the selective image and can be determining the
locations of the characters to be identifying on the registration plate have been designed
and developed.

Generally, this project has four main stages that have to be done to make this
project success. Capture and loading image are the first stage that has to be done before
image processing techniques take place. Overall, all the desire images are successfully
loaded and result of image processing has shown great result. Determining the character
location and the character identification are another two last stages that make this system
complete. Results of these two stages can be improved using a suggestion in the
recommended section as results for this project are not accurate as a wish.

36

5.2

Limitation

There are many limitations of this system where the obvious limitation it is not a
real time system. Besides, the image processing for this project take time to be done and
this make it is not suitable to apply for application that need immediate result.
Additionally, the result also cannot be saving automatically and once more have to do
manually and take a time to be done.

5.3

Problem Faced

The biggest problem that has to be faced during working on this project is to
determine the suitable threshold value T for all images. This is because not all images
can give a good result after threshold image process due to vary pixel value of the
image.

Capture the image using the standard digital camera instead using a high
resolution camera also give a problem due to the lots of noises to be removed. Lots of
information of image seems lost after the enhancement process and make the system not
too efficient in identify the characters.

5.4

Recommendations

Lots of improvement can be done on the system to make it more reliable and
efficient in the future. The system can be further improved to identify registration plates
that have bad quality of image for example the image that was taken in bad whether or in
the night. Since the image consists of varies pixel values, the system suppose can
generate a suitable threshold value for every different image to avoid the loss of

37

information. In this case, the adaptive thresholding technique is more suitable to apply
so that the threshold value based on the specified image information can be obtained.
Besides, the image of static vehicles can be replaced to the movement car for the real
time system and the best suitable analysis that can be use is image morphology where it
used to reconstruct the image blurring.

This system also can be build using a more powerful programming language like
a Matlab or Java for better reliability. It is also important to make sure this system can
function in a real time and can give instant results to make it more valuable.

38

REFERENCES

1. http:// www.licenseplaterecognition.com retrieved on August 2008

2. Mohamad Rahmat bin Wahab. Vehicle License Plate and Container


Identification System. Degree thesis. Universiti Teknologi Malaysia; 1999

3. Lee Seow Sung. Vehicle License Plate Recognition System. Degree thesis.
Universiti Teknologi Malaysia; 2001

4. Anoop Sehgal A/L Paras Ram. Design of a Recognition System for Special
Malaysian Car Plate. Master thesis. Universiti Teknologi Malaysia; 2005

5. Tava Manggai A/P Muthusamy. Car License Plate Recognition System. Degree
thesis. Universiti Teknologi Malaysia; 2006

6. http://en.wikipedia.org/wiki/Digital_image_processing retrieved on January 2009

7. Jain, Anil K. Fundamentals of Digital Image Processing. Englewood Cliffs,


NJ.:Prentice Hall. 1989

8. http://en.wikipedia.org/wiki/Pattern_matching retrieved on March 2009

9. Nicolaisen, Nancy. The Visual Guide to Visual C++: The Pictorial Encyclopedia
of the Windows Programming Language. Chapel Hill, NC.: The Ventana Press
Visual GuideTM Series. 1994

39

APPENDIX A

Source Code for Vehicle Registration Plate Identification System

// vrpiDlg.cpp : implementation file


//
#include "stdafx.h"
#include "vrpi.h"
#include "vrpiDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////////////////////////////////////////////////
//
CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX);
// DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}

40
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//////////////////////////////////////////////////////////////////////
// CVrpiDlg dialog
CVrpiDlg::CVrpiDlg(CWnd* pParent /*=NULL*/)
: CDialog(CVrpiDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CVrpiDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon
in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CVrpiDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CVrpiDlg)
DDX_Control(pDX, IDC_NEGATE, m_cNegate);
DDX_Control(pDX, IDC_RECOG, m_cRecog);
DDX_Control(pDX, IDC_SEARCH, m_cSearch);
DDX_Control(pDX, IDC_SHARP, m_cSharp);
DDX_Control(pDX, IDC_THRES, m_cThres);
DDX_Control(pDX, IDC_SMOOTH, m_cSmooth);
DDX_Control(pDX, IDC_LOAD, m_ldFile);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CVrpiDlg, CDialog)
//{{AFX_MSG_MAP(CVrpiDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_MOUSEMOVE()
ON_BN_CLICKED(IDC_EXIT, OnExit)
ON_BN_CLICKED(IDC_LOAD, OnLoad)
ON_BN_CLICKED(IDC_SMOOTH, OnSmooth)
ON_BN_CLICKED(IDC_SHARP, OnSharp)
ON_BN_CLICKED(IDC_THRES, OnThres)
ON_BN_CLICKED(IDC_NEGATE, OnNegate)
ON_BN_CLICKED(IDC_SEARCH, OnSearch)
ON_BN_CLICKED(IDC_RECOG, OnRecog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//////////////////////////////////////////////////////////////////////
// CVrpiDlg message handlers
BOOL CVrpiDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

41
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX,strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE);
// Set big icon
SetIcon(m_hIcon, FALSE);
// Set small icon
// TODO: Add extra initialization here
m_cNegate.EnableWindow(FALSE);
m_cSmooth.EnableWindow(FALSE);
m_cSharp.EnableWindow(FALSE);
m_cRecog.EnableWindow(FALSE);
m_cThres.EnableWindow(FALSE);
m_cSearch.EnableWindow(FALSE);
return TRUE;
// return TRUE unless you set the focus to a control
}
void CVrpiDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
//If you add a minimize button to your dialog, you will need the code
below to draw the icon. For MFC applications using the document/view
model,this is automatically done for you by the framework.
void CVrpiDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}

42
else
{
CDialog::OnPaint();
}
}
//The system calls this to obtain the cursor to display while the user
drags the minimized window.
HCURSOR CVrpiDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
//////////////////////////////////////////////////////////////////////
void CVrpiDlg::OnMouseMove(UINT nFlags, CPoint point)
{
CString str;
str.Format("(%d,%d)",point.x-30,point.y-35);
SetDlgItemText(IDC_LOCATION,str);
CDialog::OnMouseMove(nFlags, point);
}
//////////////////////////////////////////////////////////////////////
void CVrpiDlg::OnExit()
{
int Exit=MessageBox("Are you sure you want to exit this
program?","Exit Program",MB_YESNO+MB_ICONQUESTION);
if(Exit==IDYES)
{
OnOK();
}
}
//////////////////////////////////////////////////////////////////////
void CVrpiDlg::OnLoad()
{
CClientDC dc(this);
CString m_sFileName, FileExt;
char szFilter []="Bitmap Files(*.bmp)|*.bmp||";
CFileDialog
m_ldFile(TRUE,/*DefFileExt*/NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPR
OMPT,szFilter,NULL);
if (m_ldFile.DoModal()==IDOK)
{
m_sFileName=m_ldFile.GetFileName();
UpdateData (FALSE);
FileExt=m_ldFile.GetFileExt();
FileExt.MakeUpper();
CDC dcMem;
BITMAP bm;
m_hBmpNew =
(HBITMAP)::LoadImage(AfxGetInstanceHandle(),m_sFileName,IMAGE_BITMAP,0
,0, LR_LOADFROMFILE|LR_CREATEDIBSECTION);
GetObject(m_hBmpNew,sizeof(BITMAP),&bm);
dcMem.CreateCompatibleDC(NULL);
::SelectObject(dcMem.m_hDC,m_hBmpNew);
dc.StretchBlt(30,35,350,220,&dcMem,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY)
;
}
m_cSmooth.EnableWindow(TRUE);
}

43
//////////////////////////////////////////////////////////////////////
void CVrpiDlg::OnSmooth()
{
CClientDC dc(this);
CDC sourceDC,smoothDC;
sourceDC.CreateCompatibleDC(NULL);
smoothDC.CreateCompatibleDC(NULL);
BITMAP bm;
GetObject(m_hBmpNew,sizeof(bm),&bm);
int Width=bm.bmWidth;
int Height=bm.bmHeight;
HBITMAP
hbmpresultsmooth=::CreateCompatibleBitmap(CClientDC(NULL),Width,Height
);
HBITMAP
hbmpOldsource=(HBITMAP)::SelectObject(sourceDC.m_hDC,m_hBmpNew);
HBITMAP
hbmpOldsmooth=(HBITMAP)::SelectObject(smoothDC.m_hDC,hbmpresultsmooth)
;
hbitmap1=hbmpresultsmooth;
int x,y,result,a[9];
float value;
for(y=0;y<=Height;y++)
{
for(x=0;x<=Width;x++)
{
a[0]=sourceDC.GetPixel(x-1,y-1)&0x000000ff;
a[1]=sourceDC.GetPixel(x-1,y)&0x000000ff;
a[2]=sourceDC.GetPixel(x-1,y+1)&0x000000ff;
a[3]=sourceDC.GetPixel(x,y-1)&0x000000ff;
a[4]=sourceDC.GetPixel(x,y)&0x000000ff;
a[5]=sourceDC.GetPixel(x,y+1)&0x000000ff;
a[6]=sourceDC.GetPixel(x+1,y-1)&0x000000ff;
a[7]=sourceDC.GetPixel(x+1,y)&0x000000ff;
a[8]=sourceDC.GetPixel(x+1,y+1)&0x000000ff;
value=(float)1/9*(a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]+a[8]);
if(value>255)value=255;
if(value<0)value=0;
result=(int)value + ((int)value<<8) + ((int)value<<16);
smoothDC.SetPixel(x,y,result);
}
}
dc.StretchBlt(30,35,350,220,&smoothDC,0,0,Width,Height,SRCCOPY);
m_cSmooth.EnableWindow(FALSE);
m_cSharp.EnableWindow(TRUE);
}
//////////////////////////////////////////////////////////////////////
void CVrpiDlg::OnSharp()
{
CClientDC dc(this);
CDC sourceDC,sharpDC;
sourceDC.CreateCompatibleDC(NULL);
sharpDC.CreateCompatibleDC(NULL);
BITMAP bm;
GetObject(hbitmap1,sizeof(bm),&bm);
int Width=bm.bmWidth;
int Height=bm.bmHeight;

44
HBITMAP
hbmpresultsharp=::CreateCompatibleBitmap(CClientDC(NULL),Width,Height)
;
HBITMAP
hbmpOldsource=(HBITMAP)::SelectObject(sourceDC.m_hDC,hbitmap1);
HBITMAP
hbmpOldsharp=(HBITMAP)::SelectObject(sharpDC.m_hDC,hbmpresultsharp);
hbitmap2=hbmpresultsharp;
int x,y,result,a[9];
float value;
for(y=0;y<=Height;y++)
{
for(x=0;x<=Width;x++)
{
a[0]=sourceDC.GetPixel(x-1,y-1)&0x000000ff;
a[1]=sourceDC.GetPixel(x-1,y)&0x000000ff;
a[2]=sourceDC.GetPixel(x-1,y+1)&0x000000ff;
a[3]=sourceDC.GetPixel(x,y-1)&0x000000ff;
a[4]=sourceDC.GetPixel(x,y)&0x000000ff;
a[5]=sourceDC.GetPixel(x,y+1)&0x000000ff;
a[6]=sourceDC.GetPixel(x+1,y-1)&0x000000ff;
a[7]=sourceDC.GetPixel(x+1,y)&0x000000ff;
a[8]=sourceDC.GetPixel(x+1,y+1)&0x000000ff;
value=(float)1/7*(-a[0]-2*a[1]-a[2]-2*a[3]+19*a[4]-2*a[5]-a[6]-2*a[7]a[8]);
if(value>255)value=255;
if(value<0)value=0;
result=(int)value + ((int)value<<8) + ((int)value<<16);
sharpDC.SetPixel(x,y,result);
}
}
dc.StretchBlt(30,35,350,220,&sharpDC,0,0,Width,Height,SRCCOPY);
m_cSharp.EnableWindow(FALSE);
m_cThres.EnableWindow(TRUE);
}
//////////////////////////////////////////////////////////////////////
void CVrpiDlg::OnThres()
{
CClientDC dc(this);
CDC sourceDC;
CDC binarizeDC;
sourceDC.CreateCompatibleDC(NULL);
binarizeDC.CreateCompatibleDC(NULL);
BITMAP bm;
::GetObject(hbitmap2,sizeof(bm),&bm);
int Width=bm.bmWidth;
int Height=bm.bmHeight;
HBITMAP
hbmpresultbinarize=::CreateCompatibleBitmap(CClientDC(NULL),Width,Heig
ht);
HBITMAP
hbmpOldsource=(HBITMAP)::SelectObject(sourceDC.m_hDC,hbitmap2);
HBITMAP
hbmpOldbinarize=(HBITMAP)::SelectObject(binarizeDC.m_hDC,hbmpresultbin
arize);
hbitmap3=hbmpresultbinarize;
int r[550][259];
int x,y,result;

45
for(y=0;y<=Height;y++)
{
for(x=0;x<=Width;x++)
{
r[x][y]=sourceDC.GetPixel(x,y)&0x000000ff;
if(r[x][y]<=185) r[x][y]=0;
if(r[x][y]>185) r[x][y]=255;
if(r[x][y]>255) r[x][y]=255;
if(r[x][y]<0) r[x][y]=0;
result=((int)r[x][y]) + ((int)r[x][y]<<8) + ((int)r[x][y]<<16);
binarizeDC.SetPixel(x,y,result);
}
}
dc.StretchBlt(30,35,350,220,&binarizeDC,0,0,Width,Height,SRCCOPY);
m_cThres.EnableWindow(FALSE);
m_cNegate.EnableWindow(TRUE);
}
//////////////////////////////////////////////////////////////////////
void CVrpiDlg::OnNegate()
{
CClientDC dc(this);
CDC sourceDC;
CDC negateDC;
sourceDC.CreateCompatibleDC(NULL);
negateDC.CreateCompatibleDC(NULL);
BITMAP bm;
::GetObject(hbitmap3,sizeof(bm),&bm);
int Width=bm.bmWidth;
int Height=bm.bmHeight;
HBITMAP
hbmpresultnegate=::CreateCompatibleBitmap(CClientDC(NULL),Width,Height
);
HBITMAP
hbmpOldsource=(HBITMAP)::SelectObject(sourceDC.m_hDC,hbitmap3);
HBITMAP
hbmpOldnegate=(HBITMAP)::SelectObject(negateDC.m_hDC,hbmpresultnegate)
;
hbitmap4=hbmpresultnegate;
int x,y;
for(y=0;y<=Height;y++)
{
for(x=0;x<=Width;x++)
{
negateDC.SetPixel(x,y,0x00ffffff-(sourceDC.GetPixel(x,y)));
}
}
dc.StretchBlt(30,35,350,220,&negateDC,0,0,Width,Height,SRCCOPY);
m_cNegate.EnableWindow(FALSE);
m_cSearch.EnableWindow(TRUE);
}
//////////////////////////////////////////////////////////////////////
void CVrpiDlg::OnSearch()
{
CClientDC dc(this);
CDC sourceDC;
CDC searchDC;
sourceDC.CreateCompatibleDC(NULL);
searchDC.CreateCompatibleDC(NULL);

46
BITMAP bm;
::GetObject(hbitmap4,sizeof(bm),&bm);
int Width=bm.bmWidth;
int Height=bm.bmHeight;
HBITMAP
hbmpresultsearch=::CreateCompatibleBitmap(CClientDC(NULL),Width,Height
);
HBITMAP
hbmpOldsource=(HBITMAP)::SelectObject(sourceDC.m_hDC,hbitmap4);
HBITMAP
hbmpOldsearch=(HBITMAP)::SelectObject(searchDC.m_hDC,hbmpresultsearch)
;
CString str;
hbitmap5=hbmpresultsearch;
int x,y,m,n,z;
x=0;
y=Height/2;
do
{
for(x=0;x<Width;x++)
{
z=sourceDC.GetPixel(x,y)&0x000000ff;
if(z==0)
{
m=x;
locX=("%d",m);
n=y;
locY=("%d",n);
UpdateData(FALSE);
break;
}
}
y++;
}
while(z!=0);
str.Format("(%d,%d)",m,n);
SetDlgItemText(IDC_PIXEL,str);
m_cSearch.EnableWindow(FALSE);
m_cRecog.EnableWindow(TRUE);
}
//////////////////////////////////////////////////////////////////////
void CVrpiDlg::OnRecog()
{
CClientDC dc(this);
CDC sourceDC;
CDC recognizeDC;
sourceDC.CreateCompatibleDC(NULL);
recognizeDC.CreateCompatibleDC(NULL);
BITMAP bm;
::GetObject(hbitmap4,sizeof(bm),&bm);
int Width=bm.bmWidth;
int Height=bm.bmHeight;
HBITMAP
hbmpresultrecognize=::CreateCompatibleBitmap(CClientDC(NULL),Width,Hei
ght);
HBITMAP
hbmpOldsource=(HBITMAP)::SelectObject(sourceDC.m_hDC,hbitmap4);

47
HBITMAP
hbmpOldrecognize=(HBITMAP)::SelectObject(recognizeDC.m_hDC,hbmpresultr
ecognize);
int m,n,i,x,y,j,k,a,b,flag,test,match;
int temp[20][36];
CString str,str_temp,str_a[1000];
str=' ';
m=locX;
n=locY + 18;
int mc[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
float ratio,ratio_char;
int got_it=0;
int char_count=0;
int CHAR_A[20][16]={1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,
1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,
1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,
1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,
1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,
1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,
1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,
1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,
1,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,
1,1,0,0,0,0,0,1,1,0,0,0,0,0,1,1,
1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,
1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,
1,0,0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,
1,1,0,0,0,0,0,0,0,0,1,1,
1,1,0,0,0,0,0,0,0,0,1,1};
for(test=0;test<1000000;test++)
{
flag=0;ratio=0;
for(i=0;i<20;i++)
{
for(j=0;j<36;j++)
{
temp[i][j]=sourceDC.GetPixel(m+j-8,n+i)&0x000000ff;
if(temp[i][j]==255)
temp[i][j]=1;
}
}
//checking for A
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<16;j++)
{
if(temp[i][j+2]==CHAR_A[i][j])
match++;

59
}
}
ratio_char=float(match)/(20*16);
if(ratio_char>ratio)
{
str_temp='A';
ratio=ratio_char;
}
}
//checking for B
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<16;j++)
{
if(temp[i][j+8]==CHAR_B[i][j])
match++;
}
}
ratio_char=float(match)/(20*16);
if(ratio_char>ratio)
{
str_temp='B';
ratio=ratio_char;
}
}
//checking for C
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<14;j++)
{
if(temp[i][j+4]==CHAR_C[i][j])
match++;
}
}
ratio_char=float(match)/(20*14);
if(ratio_char>ratio)
{
str_temp='C';
ratio=ratio_char;
}
}
//checking for D
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<16;j++)
{
if(temp[i][j+8]==CHAR_D[i][j])
match++;
}
}
ratio_char=float(match)/(20*16);
if(ratio_char>ratio)
{

60
str_temp='D';
ratio=ratio_char;
}
}
//checking for E
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<14;j++)
{
if(temp[i][j+8]==CHAR_E[i][j])
match++;
}
}
ratio_char=float(match)/(20*14);
if(ratio_char>ratio)
{
str_temp='E';
ratio=ratio_char;
}
}
//checking for F
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<14;j++)
{
if(temp[i][j+8]==CHAR_F[i][j])
match++;
}
}
ratio_char=float(match)/(20*14);
if(ratio_char>ratio)
{
str_temp='F';
ratio=ratio_char;
}
}
//checking for G
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<16;j++)
{
if(temp[i][j+4]==CHAR_G[i][j])
match++;
}
}
ratio_char=float(match)/(20*16);
if(ratio_char>ratio)
{
str_temp='G';
ratio=ratio_char;
}
}

61
//checking for H
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<16;j++)
{
if(temp[i][j+8]==CHAR_H[i][j])
match++;
}
}
ratio_char=float(match)/(20*16);
if(ratio_char>ratio)
{
str_temp='H';
ratio=ratio_char;
}
}
//checking for J
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<12;j++)
{
if(temp[i][j]==CHAR_J[i][j])
match++;
}
}
ratio_char=float(match)/(20*12);
if(ratio_char>ratio)
{
str_temp='J';
ratio=ratio_char;
}
}
//checking for K
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<16;j++)
{
if(temp[i][j+8]==CHAR_K[i][j])
match++;
}
}
ratio_char=float(match)/(20*16);
if(ratio_char>ratio)
{
str_temp='K';
ratio=ratio_char;
}
}
//checking for L
if(flag==0)
{
match=0;
for(i=0;i<20;i++)

62
{
for(j=0;j<18;j++)
{
if(temp[i][j+8]==CHAR_L[i][j])
match++;
}
}
ratio_char=float(match)/(20*18);
if(ratio_char>ratio)
{
str_temp='L';
ratio=ratio_char;
}
}
//checking for M
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<20;j++)
{
if(temp[i][j+8]==CHAR_M[i][j])
match++;
}
}
ratio_char=float(match)/(20*20);
if(ratio_char>ratio)
{
str_temp='M';
ratio=ratio_char;
}
}
//checking for N
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<16;j++)
{
if(temp[i][j+8]==CHAR_N[i][j])
match++;
}
}
ratio_char=float(match)/(20*16);
if(ratio_char>ratio)
{
str_temp='N';
ratio=ratio_char;
}
}
//checking for P
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<16;j++)
{
if(temp[i][j+8]==CHAR_P[i][j])
match++;

63
}
}
ratio_char=float(match)/(20*16);
if(ratio_char>ratio)
{
str_temp='P';
ratio=ratio_char;
}
}
//checking for Q
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<18;j++)
{
if(temp[i][j+4]==CHAR_Q[i][j])
match++;
}
}
ratio_char=float(match)/(20*18);
if(ratio_char>ratio)
{
str_temp='Q';
ratio=ratio_char;
}
}
//checking for R
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<18;j++)
{
if(temp[i][j+8]==CHAR_R[i][j])
match++;
}
}
ratio_char=float(match)/(20*18);
if(ratio_char>ratio)
{
str_temp='R';
ratio=ratio_char;
}
}
//checking for S
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<14;j++)
{
if(temp[i][j+6]==CHAR_S[i][j])
match++;
}
}
ratio_char=float(match)/(20*14);
if(ratio_char>ratio)
{

64
str_temp='S';
ratio=ratio_char;
}
}
//checking for T
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<16;j++)
{
if(temp[i][j+8]==CHAR_T[i][j])
match++;
}
}
ratio_char=float(match)/(20*16);
if(ratio_char>ratio)
{
str_temp='T';
ratio=ratio_char;
}
}
//checking for U
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<16;j++)
{
if(temp[i][j+8]==CHAR_U[i][j])
match++;
}
}
ratio_char=float(match)/(20*16);
if(ratio_char>ratio)
{
str_temp='U';
ratio=ratio_char;
}
}
//checking for V
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<16;j++)
{
if(temp[i][j+8]==CHAR_V[i][j])
match++;
}
}
ratio_char=float(match)/(20*16);
if(ratio_char>ratio)
{
str_temp='V';
ratio=ratio_char;
}
}

65
//checking for W
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<28;j++)
{
if(temp[i][j+8]==CHAR_W[i][j])
match++;
}
}
ratio_char=float(match)/(20*28);
if(ratio_char>ratio)
{
str_temp='W';
ratio=ratio_char;
}
}
//checking for X
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<18;j++)
{
if(temp[i][j+8]==CHAR_X[i][j])
match++;
}
}
ratio_char=float(match)/(20*18);
if(ratio_char>ratio)
{
str_temp='X';
ratio=ratio_char;
}
}
//checking for Y
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<20;j++)
{
if(temp[i][j+8]==CHAR_Y[i][j])
match++;
}
}
ratio_char=float(match)/(20*20);
if(ratio_char>ratio)
{
str_temp='Y';
ratio=ratio_char;
}
}
//checking for Z
if(flag==0)
{
match=0;
for(i=0;i<20;i++)

66
{
for(j=0;j<18;j++)
{
if(temp[i][j+8]==CHAR_Z[i][j])
match++;
}
}
ratio_char=float(match)/(20*18);
if(ratio_char>ratio)
{
str_temp='Z';
ratio=ratio_char;
}
}
//checking for 1
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<12;j++)
{
if(temp[i][j+2]==CHAR_1[i][j])
match++;
}
}
ratio_char=float(match)/(20*12);
if(ratio_char>ratio)
{
str_temp='1';
ratio=ratio_char;
}
}
//checking for 2
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<12;j++)
{
if(temp[i][j+6]==CHAR_2[i][j])
match++;
}
}
ratio_char=float(match)/(20*12);
if(ratio_char>ratio)
{
str_temp='2';
ratio=ratio_char;
}
}
//checking for 3
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<12;j++)
{
if(temp[i][j+6]==CHAR_3[i][j])

67
match++;
}
}
ratio_char=float(match)/(20*12);
if(ratio_char>ratio)
{
str_temp='3';
ratio=ratio_char;
}
}
//checking for 4
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<12;j++)
{
if(temp[i][j]==CHAR_4[i][j])
match++;
}
}
ratio_char=float(match)/(20*12);
if(ratio_char>ratio)
{
str_temp='4';
ratio=ratio_char;
}
}
//checking for 5
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<12;j++)
{
if(temp[i][j+8]==CHAR_5[i][j])
match++;
}
}
ratio_char=float(match)/(20*12);
if(ratio_char>ratio)
{
str_temp='5';
ratio=ratio_char;
}
}
//checking for 6
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<12;j++)
{
if(temp[i][j+6]==CHAR_6[i][j])
match++;
}
}
ratio_char=float(match)/(20*12);
if(ratio_char>ratio)

68
{
str_temp='6';
ratio=ratio_char;
}
}
//checking for 7
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<12;j++)
{
if(temp[i][j+8]==CHAR_7[i][j])
match++;
}
}
ratio_char=float(match)/(20*12);
if(ratio_char>ratio)
{
str_temp='7';
ratio=ratio_char;
}
}
//checking for 8
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<12;j++)
{
if(temp[i][j+6]==CHAR_8[i][j])
match++;
}
}
ratio_char=float(match)/(20*12);
if(ratio_char>ratio)
{
str_temp='8';
ratio=ratio_char;
}
}
//checking for 9
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<12;j++)
{
if(temp[i][j+6]==CHAR_9[i][j])
match++;
}
}
ratio_char=float(match)/(20*12);
if(ratio_char>ratio)
{
str_temp='9';
ratio=ratio_char;
}
}

69

//checking for 0
if(flag==0)
{
match=0;
for(i=0;i<20;i++)
{
for(j=0;j<12;j++)
{
if(temp[i][j+6]==CHAR_0[i][j])
match++;
}
}
ratio_char=float(match)/(20*12);
if(ratio_char>ratio)
{
str_temp='0';
ratio=ratio_char;
}
}
if(ratio>0.7)
{
int in_char=0;
for(i=0;i<20;i++)
{
if(m<(mc[i]+5)&&(m>(mc[i]-5)))
in_char=1;
}
if(in_char==0)
{
mc[char_count]=m;
char_count++;
got_it=1;
str_a[m]=str_temp;
if(str_temp=='H')m=m+12;
if(str_temp=='K')m=m+10;
if(str_temp=='M')m=m+16;
if(str_temp=='N')m=m+12;
if(str_temp=='U')m=m+12;
if(str_temp=='V')m=m+12;
if(str_temp=='W')m=m+24;
if(str_temp=='X')m=m+14;
if(str_temp=='Y')m=m+16;
}
}
if(ratio<0.7)
{
int iResults;
iResults=MessageBox("Sorry,could not recognize this
image!","Recognition Error",MB_OK|MB_ICONSTOP);
break;
}
y=n;
if(got_it==0)
{
if(y==Height)goto exit_loop;
for(x=m;x<Width;x++)
{
j=sourceDC.GetPixel(x,y)&0x000000ff;
if(j==255)

70
{
a=x;
b=y;
UpdateData(FALSE);
break;
}
}
scan_again:
for(x=a;x<Width;x++)
{
k=sourceDC.GetPixel(x,y)&0x000000ff;
if(k==0)
{
m=x;
n=y;
UpdateData(FALSE);
break;
}
}
if(x==Width)
{
y++;
a=0;
goto scan_again;
}
}
if(got_it==10)
{
if(y==Height)goto exit_loop;
for(x=m;x<Width;x++)
{
j=sourceDC.GetPixel(x,y)&0x000000ff;
if(j==255)
{
a=x;
b=y;
UpdateData(FALSE);
break;
}
}
for(x=a;x<Width;x++)
{
k=sourceDC.GetPixel(x,y)&0x000000ff;
if(k==0)
{
m=x;
n=y;
UpdateData(FALSE);
break;
}
if(x==Width)
{
y++;
a=0;
goto scan_again;
}
}
}

71
exit_loop:
int mc_temp;
for(i=0;i<19;i++)
{
for(j=0;j<19;j++)
{
if(mc[j]>mc[j+1])
{
mc_temp=mc[j];
mc[j]=mc[j+1];
mc[j+1]=mc_temp;
}
}
}
for(i=0;i<20;i++)
{
if(mc[i]!=0)
str=str + str_a[mc[i]];
}
SetDlgItemText(IDC_DISPLAY,str);
m_cRecog.EnableWindow(FALSE);
}
}

Potrebbero piacerti anche