Your SlideShare is downloading. ×
  • Like
  • Save
UPC Barcode Decoding
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

UPC Barcode Decoding

  • 672 views
Published

 

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
672
On SlideShare
0
From Embeds
0
Number of Embeds
6

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. UPC Barcode Decoding Vladimir Kulyukinwww.youtube.com/vkedco www.vkedco.blogspot.com
  • 2. Outline ● Barcode Decoding Approaches ● Barcode Scanlines ● Barcode Formats ● Decoding UPC-A Formatswww.youtube.com/vkedco www.vkedco.blogspot.com
  • 3. Barcode Decoding ● Barcode decoding is the process of converting the image of a barcode into a string of digit characters ● There are several approaches to barcode decoding: – Scanline – Hough transform – Neural networkwww.youtube.com/vkedco www.vkedco.blogspot.com
  • 4. Scanlines ● Scanlines are strips of images ● Scanlines are most frequently taken to be one pixel lines that run across the width of the image ● Scanlines can be obtained from RGB, grayscale or binarized imageswww.youtube.com/vkedco www.vkedco.blogspot.com
  • 5. Two Types of Scanlines I ● Let S be a scanline obtained from an original image I B ● Let S be a scanline obtained from a binarized image B ● Both types of scanlines are used in barcode decodingwww.youtube.com/vkedco www.vkedco.blogspot.com
  • 6. I Scanline Swww.youtube.com/vkedco www.vkedco.blogspot.com
  • 7. B Scanline Swww.youtube.com/vkedco www.vkedco.blogspot.com
  • 8. Line Widths & Line Colors ● Scanline S can be encoded as a sequence of barcode line widths (LW) ● Scanline S can also be encoded as a sequence of line colors: in case of barcodes we can represent white as 1 (or 255) and black as 0 (LC) ● Scanline S can be represented as a pair of sequences (LW, LC)www.youtube.com/vkedco www.vkedco.blogspot.com
  • 9. B Scanline S LW = 1111221113211 LC = 1010101010101 SB = (LW, LC)www.youtube.com/vkedco www.vkedco.blogspot.com
  • 10. I I I Converting S to LW , LC 1) SI = (s0, s1, ..., sn-1), sk = (k, ik), k is the k-th pixel in SI and ik is its intensity 2)M = mean(i0, … ,in-1) = mean intensity 3) P = (p0, … ,pk) = sequence of intersection points of SI with y = Mwww.youtube.com/vkedco www.vkedco.blogspot.com
  • 11. I I I Converting S to LW , LC 1) The objective is to convert SI = (s0, s1, ..., sn-1), into LWI and LCI 2) This is done by converting P = (p0, … ,pk) into LWI = (lw0, … ,lwk-1) and LCI = (lc0, … ,lck-1)www.youtube.com/vkedco www.vkedco.blogspot.com
  • 12. I I I Converting S to LW , LC Look for pairs of consecutive points sk=(k, ik) & sk+1=(k+1, ik+1) such that ik and ik+1 lie on opposite sides of y = M; In other words, (ik < M & ik+1 > M) or (ik > M & ik+1< M)www.youtube.com/vkedco www.vkedco.blogspot.com
  • 13. I I I Converting S to LW , LC Given sj=(j, ij) & sj+1= (j+1, ij+1), the equation of line Lj is y = (ij+1– ij)(x – j) + ij, the intersection point pj = (xj, yj) of Lj and y = M is xj = (m – ij)/(ij+1– ij) + j yj = m Then lwj = xj+1– xj is the width of the j-th vertical barcode linewww.youtube.com/vkedco www.vkedco.blogspot.com
  • 14. I I I Converting S to LW , LC Given sj=(j, ij) & sj+1= (j+1, ij+1), then lcj = 1 if ij+1 > ij is and 0, otherwisewww.youtube.com/vkedco www.vkedco.blogspot.com
  • 15. Number of Scanlines - How many scanlines are enough? - It depends on the application needs, but typically there will be more than one scanline processed simultaneously.www.youtube.com/vkedco www.vkedco.blogspot.com
  • 16. UPC Formats ● UPC stands for Universal Product Code ● UPC one of the most widely used barcodes ● Several UPC barcodes: UPC-A, UPC-B, UPC-C, UPC-D, UPC-5, etc ● UPC-A is a most common formatwww.youtube.com/vkedco www.vkedco.blogspot.com
  • 17. UPC-A Format ● UPC-A is 1D linear barcode format ● UPC-A is a sequence of alternating black and white bars of varying widths ● UPC-A consists of a start pattern (S), two sequence of six digits (D), the middle pattern (M) and an end pattern (E)www.youtube.com/vkedco www.vkedco.blogspot.com
  • 18. UPC-A Format Two representations of UPC-A format: 1) SLLLLLLMRRRRRRE 2) SDDDDDDMDDDDDDEwww.youtube.com/vkedco www.vkedco.blogspot.com
  • 19. UPC-A Format 1) Let w be the width of the thinnest bar lines and let B and W be the black and white bar lines of width w 2) The start and end patterns are BWBwww.youtube.com/vkedco www.vkedco.blogspot.com
  • 20. UPC-A Format 1) Each digit is encoded by four bar lines 2) The combined width of those four bar lines is 7w 3) The middle pattern M is WBWBWwww.youtube.com/vkedco www.vkedco.blogspot.com
  • 21. UPC-A Format 1) UPC-A barcode contains 59 lines: 3 (start pattern) + 4 (per digit) x 12 + 5 (middle pattern) + 3 (end pattern) = 59 lines 2) UPC-A barcode has a width of 95w: 3w (start pattern) + 7w (per digit) x 12 + 5w (middle pattern) + 3w (end pattern) = 95wwww.youtube.com/vkedco www.vkedco.blogspot.com
  • 22. Detection of Start and End Patterns S is the start index of the barcode in a scanline E is the end index of the barcode in a scanline lwi-1 is high because it is the quiet zone following the barcode lwi+3 is hight because it the quiet zone after the d barcodewww.youtube.com/vkedco www.vkedco.blogspot.com
  • 23. Detection of Digits d Let S and E is the end indexes of the barcode in a scanline. Let w be the width of the thinnest bar line. Grab 6 x 7w pixels, and decode each of the 6 regions (each of which is 7w pixels) by matching them against the template line width patterns. Grab the middle pattern (3w pixels). Grab 6 x 7w pixels and decode each of the 6 regions (each of which is 7w pixels) by matching them against the template line width patterns.www.youtube.com/vkedco www.vkedco.blogspot.com
  • 24. References ● http://en.wikipedia.org/wiki/Universal_Product_Code ● http://www.slideshare.net/VladimirKulyukin/eyefree-barcode-detection-on-smartphwww.youtube.com/vkedco www.vkedco.blogspot.com