is for the class or type to which the productbelongs.
The manufacturer code
is given to each manufacturer by UCCcouncil for companies.
The product code
is a 5-digit number that the manufacturergives to his products.
The check digit
verifies the validity of the product. It tellswhether the barcode has been scanned properly of not.
Fig.3 A standard UPC-A barcode 
The barcode begins & ends with a
pattern, these are also termed as g
we have two blocks of black and whitestrips, separated by a central bar which is a
pattern. The two blocks on eitherside of the central bar contain the decimal code, which isdifferent for each product. Each decimal digit is encoded byusing 7 bits. Even and Odd alphabets are used for theencoding. First digit is called
the meta-number or induced digit
Fig. 4 A typical UPC barcode. Guard bars are highlighted green 
To ensure that the scanline does not go outside the boundaryof the image, we set our starting position in the middle of theimage, to the value where luminance is 0 or we start with a bar(black). Then we scan left and right from this point by usingpre-determined steps or blocks of pixels. The choice of thesteps helps us in finding the guard bars, which are used for thefirst step of the error detection.The error detection is as follows:If The first 3 bits of the binarized image are equal to 101.The bit 46 is 0, 47 is 1, 48 is 0, 49 is 1 and 50 is 0.The last three bits i.e., 93, 94 and 95 are equal to 101.Then
The binarized image is a valid UPC code. If any one of theabove mentioned conditions is not satisfied then the code isnot a valid UPC code.
implementation is given in
For the conversion of the binarized image to the decimal weagain use our knowledge of the UPC construction. There is alookup table  with which we compare our bits.We ignore first and last 3 bits as they are the
. Alsowe do not consider the central bits. As these bits are same forall the barcodes. Starting from the 4
bit (first three bits areguard bits) and selecting seven bits at a time. These seven bitsare compared with the lookup table of Figure 2 and bycomparison we allocate decimal values to the block of sevenbits. We can see from the table that if we are looking at bits tothe left of the central bits then we use the
“Left Bit Pattern”
column to compare, while if we are looking at bits on the rightof the central bits we use the
“Right Bit Pattern”.
Digit Left Bit Pattern Right Bit Pattern0 0001101 11100101 0011001 11001102 0010011 11011003 0111101 10000104 0100011 10111005 0110001 10011106 0101111 10100007 0111011 10001008 0110111 10010009 0001011 1110100