halal food recognition system using barcode nor …
TRANSCRIPT
HALAL FOOD RECOGNITION SYSTEM USING BARCODE
NOR EMILIA ZETFY BTE KHAIRUDIN
Report submitted in partial fulfilment of the requirements
For the award of the degree of
Bachelor of Computer Sciences (Software Engineering)
Faculty of Computer System & Software Engineering
UNEVERSITI MALAYSIA PAHANG
APRIL 2010
ABSTRACT
With the steady growth and affordability of webeam, more
applications technology is necessary. Nowadays the industry technology began to
pay more attention to barcode applications for domestic users need. This thesis
describes a. webeam support application for Muslims to identify the Halal status
(prepared in accordance to Islamic law) of the product. The barcode image is using
several images preprocessing technique in order to extract the bat-code into
database and also barcode recognition process. Halal Food Recognition System
Using Barcode is a low cost barcode reader, which was developed by using a
simple webcam as the input device. Barcodes are a class of the simplest printed
patterns that can be reliably recognized by a computer. These codes, consist of
sequence of parallel, light and dark stripes printed on papers. This is a real time
application and that requires good processing power. This is the main reason for
using the language MatLab for the development of the Halal Food Recognition
System Using Barcode. The webcam application is an economical and effective
way to speed up the .Halal verification process. This thesis discusses the barcode
concept and its applications in consumer product industry. The experimental results
obtained have system able to shown that recognition rates of 68% have been
achieved. The result also revealed that the technique is robust and invariant to
rotation. For future research and development can be done to improve the
percentage of recognition so that zero error recognition is achieved.
vi
ABSTRAK
Dengan pertumbuhan yang stabil dari webcarn, lebih aplikasi teknologi
yang diperlukan. Teknologi industri lebih menumpukan aplikasi barcode. Sistem
mi niemberitahu umat Islam untuk mengenalpasti status Halal (sesuai dengan
undang-undang Islam) dari produk tersebut menggunakan webcam. Gambar
barcode akan menjalankan teknik preprocessing untuk mengekstrak imej
tersebut. Sistem mi mernerlukan kos yang rendah untuk rnembangunkannya.
Barcode adaah bahan yang paling mudah dicetak oleh komputer. Kod-kod mi
terdiri dari rangkaian selari, garis-garis terang dan gelap dicetak di atas kertas. ml
adalah aplikasi real time dan memerlukan daya proses yang baik. Sistem liii
menggunakan perisian Matlab dalam melaksanakan projek mi. Aplikasi webcarn
merupakan cara yang ekonorni dan berkesan untuk mempercepatkan proses
pengesahan Halal. Tesis mi membahaskan konsep barcode dan aplikasinya dalam
industri produk kepada pelanggan. Keputusan yang diperolehi ialah menunjukkan
bahawa 68% kejayaan telah dicapai. Keputusan mi juga rnenunjukkan bahawa
teknik mi dapat memberi keputusan yang tepat dan sistern mi juga dapat membaca
imej waaupun dalam keadaan terbajik . Untuk kajian akan datang, sisteni ml dapat
rnernberi peningkatan dengan meningkatkan peratusan kadar bacaan dan ketepatan
dalam mendapatkan keputusan yang tepat.
V11
TABLE OF CONTENTS
CHAPTER
TITLE
PAGE
DECLARATION
IL
SUPERVISOR'S DECLARATION
M
ACKNOWLEDGEMENT
IV
ABSTRACT
V
ABSTRAK
VI
TABLE OF CONTENTS
VII
LIST OF TABLES
XI
LIST OF FIGURES
XII
1
INTRODUCTION
1.1 Problem Statement 2
1.2 Project Objective 3
1.3 Project Scope 3
1.4 Organization of Thesis 3
2 LITERATURE REVIEW
2.1 Introduction barcode 5
2.2 Barcode Background 6
vi"
ix
2.3 Advantage Using Barcode 7
2.3.1 Advantages of RFID versus Barcodes 8
2.4 Type of barcode 9
2.4.1 One Dimensional barcodes 10
2.4.2 Two - Dimensional barcodes 11
2.5 The Physical Reader 12
2.5.1 Input Device 12
2.6 Barcode structure 16
2.7 Decoder 18
2.8 The barcode recognition system 19
2.8.1 Barcode Size and Colour 20
2.9 Barcode symbology 20
2.10 Recognition Algorithm 22
2.11 Existing System 25
2.12 Benefit using webcam 30
2.13 Algorithm that have been used 31
3 METHODOLOGY
3.1 Introduction of Methodology 34
3.2 Barcode Image Devices 34
3.3 System design 35
3.4 Main Barcode recognition system 35
3.4.1 Image acquisition 36
3.4.2 Image Thresholding 36
3.4.3 Feature Extraction38
3.4.4 Neural Network 37
3.4.5 Result38
3.5 Hardware and Software Requirement 39
3.6 Software approach 41
3.6.1 MatLab 41
3.6.2 Microsoft Project 2007 41
3.6.3 Microsoft PowerPoint 2007 42
3.6.4 Microsoft Office Word 2007 43
4 IMPLEMENTATION
4.1 Introduction 44
4.2 Barcode Recognition Image Pre-Processing 44
5 RESULT AND DISCUSSION
Introduction 49
5.2 Image Acquisition50
5.3 Image Preprocessing
5.4 Testing Result of Number Recognition Process 51
5.5 Constraints 51
5.6 Further research52
6 CONCLUSSION 53
REFERENCES 54
Appendix A 56
Appendix B 58
Appendix C 60
xi
LIST OF TABLES
TABLES NO TITLE PAGE
3.1 Table Hardware Requirement 34
3.2 The software required to develop the system are 34 as listed
5.1 Result of the testing process. 54
LIST OF FIGURES
FIGURE TITLE PAGE
2.1 Numeric barcode 10
2.2 Some types of barcode, 2D 11
2.3 Two - Dimensional barcodes 12
2.4 (a) Laser Scanner, (b) CCD Scanner, (c) CCD Sensor by 13 a lens
2.5 Pen-Type Reader 13
2.6 Some camera can use to read barcode 14
2.7 Digital camera card can read barcode (Photosmart mobile
camera) 14
2.8 The barcode reader with PDA 14
2.9 Barcode Structure 15
2.10 The Specification Standard of Bar Code Readers. 17
2.11 Barcode EAN- 13 19
2.12 Specification for EAN-13 barcode 19
xli
2.13 Multiple scanlines 22
2.14 Successfully recognized codes 23
2.15 Unrecognized codes 23
2.16 Canny edge detection kernels 25
2.17 Encoding tables for the EAN 13 numbering system. 25
2.18 Four line detection kernels 31
3.1 Basic architecture of the halal food recognition system 33
using barcode
3.2 System flow of the main Barcode recognition System 33
3.3 Sample barcode for food product34
3.4 Sample binary image 35
3.5 Illustrating differences between a general ROB color
image and a general gray scale image.35
3.6 Original gray-scale image 36
3.7 Steps to identify and extract the EAN-13 barcode 36
3.8 Neural network recognition process 37
4.1 Image process 44
4.2 Load Image from file 45
4.3 Waiting for loading 46
4.4 The process result 46
xli'
xlv
4.5 Database Created 47
4.6 Database table 48
4.7 System exit 48
5.1 Original image taken from food product. 49
5.2 Shows the result using line of barcode image obtained 50
5.3 The result number of barcode it's appeared. 52
5.4 The result from doing image preprocessing 51
CHAPTER 1
INTRODUCTION
1.1 Introduction
Nowadays, almost all products have its unique barcode numbers. It represents
loads of information about a product. Many people familiar with halal food issue. Other
popular applications of bar code include the logistic industry and domestic consumer
thod monitoring. The webcam has the potential of changing the consumer business
landscape in the near future. Also it has opened up exciting new channels for any type of
products identification using mobile technology. Meanwhile, Halal consumer products
have become a crucial concern that affects Malaysian's Muslims as well as around 1 .5
billion Muslim throughout the world. The word Halal (JtJ ) is an Arabic term meaning
"permissible" It is important to understand that Halal is a unique comprehensive Islamic
concept encompasses the matters of food and drink, and all other matters of daily life. in
Malaysia, the Department of Islamic Development (JAKIM) is responsible for Halal
certification. This approval can only be issued by JAKIM. it covers consumer products
such as foods, drinks, cosmetics, etc. Each of these must pass the JAK1M requirements
for Halal Certification
2
Now. the JAKI.M department was provided SMS (Short Message System) to user
know about the food status only send the food barcode and get the response in real time.
For this Halal Food Recognition Using Barcode System, user can know the food status
only scan the barcode image to capture by camera To make food reorganization
processes become more effective, this proposed system is developed to make more
systematic a consistence. It also keeps all the data about the food on the database. By
developing this system, it can upgrade to replace the current system for example it is
provide with database to store all the information about the food. The barcode will be
applied for this system and the barcode which capture by camera to give the food status
.With the barcode on food, the identification of it will be more efficient and systematic.
1.2 Problcm Statement
Before this in market, we quick familiar hear with scanner barcode and barcode
food also. The barcode scanner only knows about the price of product. The big
problem using barcode is if a barcode becomes scratched or crumpled the reader may
not he able to read it also. For this system using camera to scan the barcode image. The
administrator (.JAKIM) keeps the barcode detail to database, using camera to catch the
barcode image to know about the food status. This image can match the data food from
the database. 2D imaging scanners are the fourth and newest type of barcode reader
currently available. They use a small video camera to capture an image of a bar code.
The reader then uses sophisticated digital image processing techniques to decode the
bar code. Video cameras use the same CCD technology as in a CCD bar code reader
except that instead of having a single row of sensors, a video camera has hundreds of
rows of sensors arranged in a two dimensional array so that they can generate an image.
3
1.3 Objective
Base on the prohielTi statement that was founded, the objectives are achieved in the
develop this system:
. Improve barcode recognition rate.
ii. Implement the webcam into barcode recognition system
1.4 Scope
i. Implement the new barcode system into HALAL food recognition system.
ii. Using line detection algorithm to improve recognition rate.
iii. To integrate a standard protocol to webcam application between barcode system.
1.5 Thesis Organization
This thesis consists of six chapters (6) that will explain each of part of the
system. Chapter one (1) will briefly explain about the overview of the entire project
including the objective, scope and problem statement.
Chapter two (2) will explains about the manual process of the Halal Food
Recognization Using Barcode System and background of the project studied.
Chapter 3 is the methodology of developing the application, it also details about
the system life cycle that start with project identification, project planning, analysis,
design, irnp!eJientation and maintenance. It also explains about the software and
hardware that will be used during develops the system.
Chapter 4 will explain about the coding of. the system and discuss about the
Structured language (sql) that will be used. System must have the right function so that it
4
will be some complete system. Sequential and right coding must be written in systematic
way.
Chapter 5 is about the output or result about Halal Food Recognization Using
Barcode Syatem.The weakness of the system will be identified. The result and
recommendation of the system will be discussed for further research of the system.
CHAPTER 2
LITERATURE REVIEW.
2.1 Introduction
Nowadays, computer application almost synonyms that have brought changes for
the better, practically in every area where they have found an application. For the
barcode, its very important area of application of computer technology, especially in the
area manufacturing, distribution, as well as in the development of management
information system.
A barcode is a code in a printed form, which can easily read by a machine connected
to the computer and the codes in the labels can be stored in the computer database. The
machine readable codes that the computer can reproduce directly into the bit streams
zeros and ones, which is the machine language of all computer also known as the digital
language.
Barcode is the most popular automatic identification technology used in many
applications. A barcode is a machine-readable code of a series of bars and spaces printed
in defined rations, whose principle function is to convey data, and symbologies are sets
of rules that relate those patterns to their encoded message.
The barcode keep the information about country code, manufacture's name, the
product details, etc. In fact the amount of information that can be stored in these labels is
limited by the choice of the symbology. It can vary from a few characters in the linear
bar code symbology to hundreds or even thousands of character depending on the type
of symbology used.
In industry barcode, to read the barcode, they use a photo sensor to convert the
barcode into electrical signal that the signal moves across the barcode. The scanner also
can measures the bars and spaces then translate the different patterns back into regular
characters, then sends them to computer.
2.2 Barcode Background
Beginning with 1932, when an ambitious project was conducted by a small group
of students headed by Wallace Flint at the Harvard University Graduate School of
Business Administration. The project proposed that customers select desired
merchandise from a catalog by removing corresponding punched cards from the catalog.
Barcode was first used commercially in 1966, however, it was soon realized that
there would have to be some sort of industry standard set. By 1970, the Universal
Grocery Products Identification Code or UGPIC was written by a company called
Logion Inc. The first company to produce barcode equipment for retail trade use (using
UGPIC) was the American company Monarch Marking in 1970, and for industrial use,
the British company Plessey Telecommunications was also first in 1970.
UGPIC evolved into the U.P.C. symbol set or Universal Product Code, which is
still used in the United States. George J. Laurer is considered the inventor of U.P.C. or
Uniform Product Code, which was invented in 1973. In June of 1974, the first U.P.C.
7
scanner was installed at a Marsh's supermarket in Troy, Ohio. The first product to have a
barcode included was a packet of Wrigley's.
2.3 Advantage and disadvantage using barcode
Firstly improve operational efficiency, barcodes is faster and more accurate
recording of information, the process can move quickly and can detect accurately. Its
needed quite a bit of time can be spent tracking down the location or status of projects,
folders, instruments, materials, or anything else that moves within an organization. Its
can help you keep better track then you can save time and respond more quickly to
inquiries and changes.
Secondly save time, depending on the using this application, time savings can be
significant. The most dramatic examples involve the beloved chore of taking inventory
is often. The barcode have the ability to process the data by the computer system,
resulting in saving time not only of the customer but also the management.
Thirdly reduce errors, clerical and data entry errors can be a significant source
of costs and related problems are extra freight costs, unhappy customers, and time spent
to track down problems. Its also economics because of the speed and reduction of the
error in data entry, users can save time and costs. Its obtain more accurate and reliable
information is an added advantage for the management in cost cutting.
Fourthly cut cost because barcodes are effective tools that can be used to
address specific, localized problems or integrated into organization-wide information
systems. When applied with thought and planning they can save time and reduce errors,
resulting in a reduction of costs.
Fifthly benefit from customer or regulatory requirements, regulatory agencies or
Your customers may impose labeling requirements that you must meet. While these
requirements may be a necessary part of doing business, you can save time and money
by utilizing the barcodes within your own operations. For example, you can collect
8
shipping manifest information quickly and accurately by scanning the barcode labels
that you printed to satisfy the customer.
There are some disadvantages in these kinds of barcode readers. These
disadvantages includes that the barcode has to be manually oriented towards the laser
beam to get the barcode value, high cost and the harmfulness for the user from the
exposure to the laser beam. In the recent past several techniques and algorithms have
been proposed for vision-based barcode reading. These Include two-step paradigms of
image feature extraction method, Hough Transformation, Neural Networks Method,
Texture Analysis and Mathematical Morphology for barcode localization within the
image and Selective Sampling method, EM Algorithm and Statistical Pattern
Recognition for decoding the sequence.
2.3.1 Advantages of RFID versus Barcodes
RFID tags and barcodes both carry information about products. However, there are
important differences between these two technologies. Barcode readers require a direct
line of sight to the printed barcode RFID readers do not require a direct line of sight to
either active RFID tags or passive RFID tags.
RFID tags can be read at much greater distances an RFID reader can pull information
from a tag at distances up to 300 feet. The range to read a barcode is much less, typically
no more than fifteen feet.
RFID readers can interrogate, or read, RFID tags much faster read rates of forty or
more tags per second are possible. Reading barcodes is much more time-consuming; due
to the fact that a direct line of sight is required, if the items are not properly oriented to
the reader it may take seconds to read an individual tag. Barcode readers usually take a
half-second or more to successfully complete a read.
Line of sight requirements also limit the ruggedness of barcodes as well as
the reusability of barcodes. Since line of sight is required for barcodes, the printed
barcode must be exposed on the outside of the product, where it is subject to greater
wear and tear. RFID tags are typically more rugged, since the electronic components are
better protected in a plastic cover. RFID tags can also be implanted within the product
itself, guaranteeing greater ruggedness and reusability.
Barcodes have no read or write capability that is, you cannot add to the information
written on a printed barcode. RFID tags, however, can be read or write devices the RFID
reader can communicate with the tag, and alter as much of the information as the tag
design will allow. RFID tags are typically more expensive than barcodes, in some cases,
much more so.
2.4 Type of barcode
To understand the contents of barcodes or be able to produce own barcodes one has
to understand the barcode symbology. The symbology is very much a like a language
defining how different combinations of various wide bars and spaces shall be
interpreted. There are many different barcode symbologies, one- dimensional or two-
dimensional, fixed-width or multi-width, each with various properties such as data
density or type of data stored, all designed to fulfill a specific purpose.
The symbology also defines properties such as, Quiet Zone, a quiet area around the
barcode to avoid interference with surrounding textures. Start and Stop Patterns, speeds
up the localization of the barcode.
Aspect Ratio, defines the relations between width and height of the whole symbol
and the different widths of bars and spaces. Parity and Redundancy, ensures a low error
rate and enables damaged barcodes to be read.
Bar code systems can use several symbologies. A symbology is equivalent to a
language. Each symbology has strengths and weaknesses. Many symbologies are around
for historical or political reasons, while others have definite technical advantages.
10
2.4.1 One Dimensional barcodes
It is employed in low information content applications like product index registry
(e.g. automatic price tagging and inventory management), or serial number registry (e.g.
test-tube tagging in automated medical tests). Two-dimensional barcodes are used in
applications that require more information contents like mail addresses (for automated
mail reading and distribution systems), or compressed content of a printed page (to
avoid the need for optical character recognition.
i. Numeric-only barcodes
IIIU UD I1UHI II 1 234567 890128 Figure 2.1: Numeric barcode
ii. Alphanumeric barcodes
It is graphical patterns composed usually of dots. They are rendered using two-
toned dots (e.g. black dots on a white background), and occupy, usually a rectangular
area. Two-dimensional barcodes incorporate various registration and fiducially marks,
enabling automated identification, and accurate registration of the barcode, which might
be read-in in arbitrary orientations. In addition, two dimensional barcode systems
employ various error correcting codes for reliable automated retrieval.
11
IIIIIIIIIIIIIIIIIIIIIIII *12345AB*
Figure 2.2: Some types of barcode, 21)
2.41 Two - Dimensional barcodes
It is graphical patterns composed usually of dots. They are rendered using
two-toned dots (e.g. black dots on a white background), and occupy, usually a
rectangular area. Two-dimensional barcodes incorporate various registration and
fiducially marks, enabling automated identification, and accurate registration of the
barcode, which might be read-in in arbitrary orientations. In addition, two dimensional
barcode systems employ various error correcting codes for reliable automated retrieval.
Figurev2.3: Two - Dimensional barcodes
23 The Physical Reader
A physical barcode reader is considered to contain two separate elements: the input
device and the decoder. These two elements can either be separated into two different
12
physical units or they can both be in one single unit. The input device includes the
electrO-Optical system and the camera system, while the decoder equals the processor.
2.5.1 Input Device
There are different ways to read a barcode: by a scanner, using a wand or a
vision-based 'device. All these devices share a common structure in how the reading
process is performed. The user either holds the reader over the barcode or holds the
barcode image in front of the reader. All approaches scan a line across the .Barcode and
measure the intensity along the scan line. High intensity corresponds to a bar and low
intensity corresponds to a space. If the scan line does not cross the entire bar code, the
code will not be read. Then, another line must be scanned such that the barcode is
converted. The user has to ensure that the scan line is in the right direction and that it
covers the entire bar code.
L Scanner
A scanner is usually a handheld device and is often used in the retail industry. In
some cases, the scanner is stationary and the user places the barcode in front of the
beam, like in the supermarket. The scanner either moves the beam over the code by itself
or the user has to move the beam over the barcode. In the second case, the user has to be
able to move his hand with some skill. The handheld device must stay at the same
distance from the barcode while the beam is moved over the code. A scanner does not
have contact with the barcode.
A handheld, moving beam scanner has a large advantage over a fixed beam
scanner. It can scan with a much higher frequency, up to 40 scans per second, and
almost no operator skill is required. There is another type of handheld scanner that uses
a raster laser scan pattern to read 2D symbols.
13
(a) (b)
r
of 09k
(c)
Figure 2.4: (a) Laser Scanner, (b) CCD Scanner, (c) CCD Sensor by a lens
ii. Wand
A wand is a handheld device with a fixed beam that physically touches the
barcode. The reading device of the wand is in the tip and the wand looks like a pen that
is moved over the barcode. The user has to provide the moving motion of the beam, and
therefore, some operator skill is required to use wand. The hardest thing is to move the
wand at the right speed and to not make too high accelerations.
Figure 2.5: Pen-Type Reader
14
iii. Vision-Based Scanning
Vision-based scanners use a camera to read the barcode. An image is taken over
the barcode area and is then analyzed so that the code can be decoded. This technique
has an advantage over the others when reading 2D-symbols. It is not as fast but more
accurate and thus better to use in some applications, than the other two techniques. The
performance and symbols available for decoding have been evaluated.
Figure 2.6: Some camera can use to read barcode
However, there are many kinds of a camera using with other devices. There are
built—in cameras, wireless camera and digital card camera. The most of modem
Smartphone's and PDA's have built-in camera. This the camera usually used with PDA
to take a picture, video, etc.
Figure 2.7: Digital camera card can read barcode (Photosmart mobile camera)