SoftwarePractice.org: Home | Courseware | Wiki | Archive

Barcode Deciphering

From SoftwarePractice.org

Barcode Deciphering

We have successfully attempted to convert the barcode image to the respective numeric code! We now have to make adjustments for noise, etc.

The barcode deciphering step is the last step within the process and converts the barcode image into its respective numeric code. We’ve created these steps from the properties of UPC-A barcodes. For a list binary codes relating to each numeral and a description of the checksum, please visit our UPC-A Barcode Standards page.


Image: decipher.jpg


Functions: checksum.m, convert.m


checksum.m

This function ensures that the barcode extracted from the image is a standard UPC-A barcode. It initially ensures that the start and stop bits are 1-0-1, which are standard to UPC-A. It also determines whether the middle guard, or bits number 46-50, inclusive, are 0-1-0-1-0. If any of these checks return an error, then we have established that this is not a UPC-A barcode and hence, we cannot successfully decipher the image.

Within this function, if the image is found to be UPC-A, we subsequently cut out the start and stop bits, for easier barcode deciphering. However, if this is not found to be a UPC-A barcode, we do not advance any further with the processing and consequently set the flag for the user to be notified that there is an error present.

Check Sum Flow Chat:

Image:Checksum.jpg


To view the corresponding Matlab code: checksum.m Code

convert.m

This function predominantly focuses on converting the sequence of binary 1s and 0s into its respective numerals, after it has been passed through checksum.m. It initially analyses the first 6 digits, that is, bits number 1 to 42, inclusive. This starts at bit number one as the start bits have been removed once the barcode is determined to be UPC-A. Thus, looking at 7 bits at a time, we are able to convert into the numeric numbers.

The process is repeated for the right-hand side 6 digits, bits number 48 to 89 inclusive. Since the left hand side and right hand side digits have different binary sequences, we have written another if statement.

The checksum is lastly determined as it is based on the values prevalent within the deciphered barcode. Following the properties of UPC-A barcodes, we multiply the sum of all odd-positioned digits by 3. Then, we add that to the sum of the odd-positioned digits. We then determine the number, that when added to the calculated sum, is a multiple of 10. This evaluated number should therefore be the value of the checksum (digit position 12). If the two numbers are not the same, then this is not a standard UPC-A barcode and a checksum error will be visible within the output GUI.


To view the corresponding Matlab Code: convert.m Code


Alternative solution

An alternative method of deciphering the Barcode Image would be the addition of analysing the first derivative of the barcode image. A clean image will observed to be composed of a sequence of Dirac delta functions, ranging from -1 to +1. This method is observed in The UPC Barcode (http://www.ima.umn.edu/~wittman/barcode/upc.html)

The entire notion of the first derivative would be to aid in deciphering the Barcode image. We did not employ the method of determining the first derivative as it was easier to plot impulses corresponding to each bar and space. The images relating to this method is observed below:

Image: barim.jpg


Back to Team F's Main Page Team F: Barcode Reading from Image

Personal tools