Академический Документы
Профессиональный Документы
Культура Документы
BEE-5D
Abstract—In this report we present the method of Barcodes are used to encode specific information about the
deciphering the barcode using image processing, and product, for the ease of consumers and shopkeepers. Several
its implementation on Matlab®. 1D barcode labeling types of devices are there to read these barcodes, e.g., LED
is a commercial method to store information about a scanners, Laser scanners etc. These devices are cumbersome to
product for the checkout systems of large marts and use and are neither readily available nor mobile. This limits the
shopping centers. Nearly all products are labeled product information to the shop owners only, to aid costumers
with barcodes at the time of their manufacturing and in extracting this information, portable solution to the
sometimes shop owners label products using their deciphering of barcodes must be provided. One of these
solutions is the deciphering of the barcode using handheld
own barcodes. The conventional bar code scanners
devices such as mobile phones and digital cameras. These
are not portable as they need both a power source
devices take the picture of the barcode and then use either an
and a computer with the database of the product, to
online platform to extract the information about the product or
be read. Also they are not readily available. It would use some other kind of connectivity to the database containing
be convenient for the costumers to read and decipher the information about the product. Retrieval of such
these barcodes using their portable devices such as information is vital for people with medical afflictions towards
digital cameras and mobile phones, In order to gain some products and for the validation of price and legitimacy of
the specific information about the product provided the product. Many efforts have been made to achieve the
by the manufacturer. Our aim in this project was to deciphering using images of camera phone (see references for
take those barcode images taken by cameras and details). These methods may be more accurate but they are
decipher them. We used edge detection to find the computationally expensive and time consuming. So we have
edges of barcode and through the knowledge of the developed a method of robust deciphering [1] of the barcode
standard that the barcode is encoded in; we convert which is a practically viable solution. The details of our
the image into the decimal code. method and its Matlab® implementation are discussed next.
1. INTRODUCTION 2. OBJECTIVES
Barcodes is a machine readable encoding process. It is The main objectives of our project were:
being used extensively throughout the world. There are
different standards of the barcode, each having its pros and Read a Barcode from a camera image
cons. The latest barcode standard is EAN, which was formerly
Decode the barcode
known as “European Article Number” but now is called
Remove any type of noise that may occur
“International Article Number”. But we have chosen UPC,
Universal Product Code, because it is the most widely used
barcode and has an error detection mechanism in it, which aids
the deciphering process.
2
3. BARCODE DETECTION In this method without searching for the edges the scanline
binarizes all the pixels. The pixel selected first is the middle
The first step in the deciphering is the detection of barcode. one. To cater for the noises first the scanline pixels are
This can be easily achieved by several edge detection smoothed and then the luminance value Y(x) Ԑ [0, 1] is
techniques. We have employed the fact that barcode is an calculated for each pixel, whose position is given by:
intensity image. It contains vertical strips of black and white
lines. So we use the gray thresh value of the image to detect
the start and the end of the barcode strips. This can be .
achieved by the wavelet transform method [3] or by
morphological operations [10] but we want a method that is Then the local minima and maxima are computed. The
both quick and efficient so we use scanline based approach. Matlab® implementation is described in Appendix A.
This method uses the fact that a horizontal scanline is at the
center of the barcode. If the image of barcode is not centered
or the center region contains distortions then the algorithm will
simply shift the scanline above or below the center of the
image until we get non distorted region. The Matlab®
implementation is given in Appendix A.
5. ERROR CHECKING
Then
6. CONVERSION
Fig.3 A standard UPC-A barcode [10] For the conversion of the binarized image to the decimal we
again use our knowledge of the UPC construction. There is a
lookup table [14] with which we compare our bits.
The barcode begins & ends with a „101‟ or “black-white-
black” pattern, these are also termed as guard bars. Between
these guard bars, we have two blocks of black and white We ignore first and last 3 bits as they are the guard bits. Also
strips, separated by a central bar which is a „01010‟ or “white- we do not consider the central bits. As these bits are same for
black-white-black-white” pattern. The two blocks on either all the barcodes. Starting from the 4th bit (first three bits are
side of the central bar contain the decimal code, which is guard bits) and selecting seven bits at a time. These seven bits
different for each product. Each decimal digit is encoded by are compared with the lookup table of Figure 2 and by
using 7 bits. Even and Odd alphabets are used for the comparison we allocate decimal values to the block of seven
encoding. First digit is called the meta-number or induced bits. We can see from the table that if we are looking at bits to
digit [1]. the left of the central bits then we use the “Left Bit Pattern”
column to compare, while if we are looking at bits on the right
of the central bits we use the “Right Bit Pattern”.
Fig. 4 A typical UPC barcode. Guard bars are highlighted green [14]
4
Once the 12 digits have been calculated the check sum bit is The Matlab® implementation is given in Appendix A
calculated, it is calculated by the following method [14]
1. The digits that are in the odd numbered positions are
added and multiplied by 3. 8. CONCLUSION
2. The digits in the even numbered positions are added. Hence we are able to achieve all of our preset objectives for
this semester project, i.e., we have successfully deciphered
3. The sum of even numbered is added to the sum of UPC barcode using image processing techniques in Matlab®.
odd numbered. We were also able to account for minor noise distortions as in
Figure 5 (d). For future our next step will be to remove as
4. The result is modulo 10.
many types of noises as we can from the image and add
5. If the result is zero then check bit is zero. Otherwise support for other barcode standards such as EAN and Codabar
subtract it from 10 and the answer is the result. as well.
9. ACKNOWLEDGMENTS
We would like to thank Mr. Saad Qaisar and Ms. Jaweria
Amjad for their support throughout the semester.
[12]. http://www.morovia.com/education/symbology/upc-a.asp
[13]. http://www.morovia.com/education/utility/upc-ean.asp
[14]. en.wikipedia.org
[15]. http://www.google.com/imghp