Skip to content

An overly simplistic JavaScript library for decoding Code 39 barcodes

Notifications You must be signed in to change notification settings

plstand/dumb3of9

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dumb 3 of 9

Purpose

Dumb 3 of 9 was created to determine how complex barcode scanning software really has to be. Using a trivial, naïve algorithm for decoding Code-39 format barcodes, it performs remarkably well on a 46-image test suite I compiled, failing only a few cases. Within 30 seconds (on a modern desktop PC), the Dumb 3 of 9 library can scan a barcode from any angle, from the JavaScript environment found in the latest Web browsers – not from a compiled language.

Do not not use this software in any environment even loosely considered "production." It can and will return inaccurate data, and it does so quite often.

Test suite

The test suite contains 46 images. Currently, Dumb 3 of 9 fails three tests in most canvas-supporting browsers (four tests in Safari).

  • list.txt is a tab-separated value (TSV) file containing the filenames of the images and corresponding outputs. A single question mark (?) as the second column of a line indicates the corresponding file contains no Code 39 barcode.
  • s??.png are synthetic barcode images generated by my own program, excluding outputs that do not include the entire barcode within the image. This test case generator is not yet included in this repository.
  • sf??.png are synthetic images containing no valid barcode, generated by a modified version of the program.
  • zxing-*.png are test cases from the ZXing barcode scanning library, version 1.6, many of which (intentionally) include other types of barcodes that should remain unrecognized by a Code-39 specific decoder.
  • inkbox.png is my own image of a Code 39 barcode from the packaging of some HP inkjet printer cartridges.
  • Note that ZBar or ZXing will pass few of these tests (without first rotating the images) because for performance reasons, they are only designed to work with horizontal and vertical barcodes.

To run the test suite, put all the files from this repository on a Web server and navigate to the URL /test-suite/index.html. Because of Web browser security limitations, trying to run the test suite directly from the hard drive will fail.

License

Copyright © 2011 PleaseStand

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

An overly simplistic JavaScript library for decoding Code 39 barcodes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published