UPC Barcode Decoding                     Vladimir Kulyukinwww.youtube.com/vkedco           www.vkedco.blogspot.com
Outline   ●       Barcode Decoding Approaches   ●       Barcode Scanlines   ●       Barcode Formats   ●       Decoding UPC...
Barcode Decoding   ●       Barcode decoding is the process of converting       the image of a barcode into a string of dig...
Scanlines   ●     Scanlines are strips of images   ●     Scanlines are most frequently taken to     be one pixel lines tha...
Two Types of Scanlines            I   ●     Let S be a scanline obtained from an     original image I           B   ●     ...
I                                     Scanline Swww.youtube.com/vkedco   www.vkedco.blogspot.com
B                                    Scanline Swww.youtube.com/vkedco   www.vkedco.blogspot.com
Line Widths & Line Colors   ●       Scanline S can be encoded as a sequence       of barcode line widths (LW)   ●       Sc...
B                                               Scanline S                         LW = 1111221113211                     ...
I                 I   I                         Converting S to LW , LC                                1) SI = (s0, s1, .....
I             I         I                         Converting S to LW , LC                                1) The objective ...
I            I       I                         Converting S to LW , LC                                Look for pairs of   ...
I                   I     I                         Converting S to LW , LC                                Given sj=(j, ij...
I               I         I                         Converting S to LW , LC                                Given sj=(j, ij...
Number of Scanlines                         - How many scanlines are                         enough?                      ...
UPC Formats   ●     UPC stands for Universal Product Code   ●     UPC one of the most widely used     barcodes   ●     Sev...
UPC-A Format   ●     UPC-A is 1D linear barcode format   ●     UPC-A is a sequence of alternating     black and white bars...
UPC-A Format           Two representations of UPC-A format:             1) SLLLLLLMRRRRRRE             2) SDDDDDDMDDDDDDEw...
UPC-A Format            1) Let w be the width of the thinnest bar           lines and let B and W be the black and white  ...
UPC-A Format            1) Each digit is encoded by four bar lines            2) The combined width of those four bar line...
UPC-A Format            1) UPC-A barcode contains 59 lines:            3 (start pattern) + 4 (per digit) x 12 + 5 (middle ...
Detection of Start and End Patterns                         S is the start index of the barcode in a scanline             ...
Detection of Digits                          d     Let S and E is the end indexes of the barcode in a scanline. Let w be t...
References  ●      http://en.wikipedia.org/wiki/Universal_Product_Code  ●      http://www.slideshare.net/VladimirKulyukin/...
Upcoming SlideShare
Loading in...5
×

UPC Barcode Decoding

723

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
723
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

UPC Barcode Decoding

  1. 1. UPC Barcode Decoding Vladimir Kulyukinwww.youtube.com/vkedco www.vkedco.blogspot.com
  2. 2. Outline ● Barcode Decoding Approaches ● Barcode Scanlines ● Barcode Formats ● Decoding UPC-A Formatswww.youtube.com/vkedco www.vkedco.blogspot.com
  3. 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. 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. 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. 6. I Scanline Swww.youtube.com/vkedco www.vkedco.blogspot.com
  7. 7. B Scanline Swww.youtube.com/vkedco www.vkedco.blogspot.com
  8. 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. 9. B Scanline S LW = 1111221113211 LC = 1010101010101 SB = (LW, LC)www.youtube.com/vkedco www.vkedco.blogspot.com
  10. 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. 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. 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. 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. 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. 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. 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. 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. 18. UPC-A Format Two representations of UPC-A format: 1) SLLLLLLMRRRRRRE 2) SDDDDDDMDDDDDDEwww.youtube.com/vkedco www.vkedco.blogspot.com
  19. 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. 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. 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. 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. 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. 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

×