Git Product home page Git Product logo

job's Introduction

BarcodeReader

BarcodeReader is a barcode reader for Code128, Code93, Code39, Standard/Industrial 2 of 5, Interleaved 2 of 5, Codabar and EAN-13 barcodes in javascript. Supports multiple barcodes in one image and detects what type of barcodes there are.

It seems that the issue with smartphones might have been one of exif orientation tags so there's a fix in BarcodeReader now and also a fix for some kind of downsampling issue for iOS.


If you like and/or use this project for commercial purposes consider donating to support my work.
PayPal - The safer, easier way to pay online!


Version 1.6 is up with a completely reworked localization process and also added a BarcodeReader object to facilitate more ease of use. Just reference BarcodeReader.js, always execute a call to BarcodeReader.Init() in the beginning and then for decoding of images set callback function using BarcodeReader.SetImageCallback(callback) and then call BarcodeReader.DecodeImage(img). Also added functionality in BarcodeReader to decode a video stream for use with getUserMedia, which was the original idea. Hopefully this localization will be a significant improvement and I will in the (hopefully) near future do a rework of the decoding algorithm to make it a bit faster and more accurate.

Change Log

v1.6.1

  • Added video support to the jQuery plugin
  • Fire event when barcode is decoded
  • Refactored jQuery elements allowing support for your own
  • Flipped video to make it easier to position the barcode

job's People

Contributors

chrisbarnett1 avatar eddiela avatar jfyuen avatar k4wo avatar kkebo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

job's Issues

[Question] Using bower

Hi,

For my Angular project, I'm using Bower. So I've executed this command because there isn't (for now) a bower package for your library :

bower install --save https://github.com/EddieLa/JOB.git

It works great. First question: did you intend to create a bower package for your library ?
Now when you include the library

...
<script src="assets/vendor/JOB/src/JOB.js"></script>
...

and call the init function

...
JOB.Init();
...

these lines place some issues

...
DecoderWorker: new Worker("DecoderWorker.js"),
...
Init: function () {
...
script.src = "exif.js";
...
}

because DecoderWorker.js and exif.js have a wrong file path. If I want your library to work I need to change your code to

...
DecoderWorker: new Worker("assets/vendor/JOB/src/DecoderWorker.js"),
...
Init: function () {
...
script.src = "assets/vendor/JOB/src/exif.js";
...
}

and it's a complicated when you want to deploy your application. Maybe it would be better to add the DecoderWorker.js and exif.js files like your library

<script src="path/to/DecoderWorker.js"></script>
<script src="path/to/exif.js"></script>
<script src="path/to/JOB.js"></script>

What do you think about this?

Uncaught TypeError: Cannot set property 'width' of null

Hi,

I just found your library and when I try to test it with an image I got the error in the subject. I want to add it in my AngularJS application.

function setFiles(element) {
  var showPicture = document.createElement("img");

  console.log(element.files);

  var URL = window.URL || window.webkitURL;
  showPicture.onload = function (event) {
    JOB.DecodeImage(showPicture);
    URL.revokeObjectURL(showPicture.src);
  };

  showPicture.src = URL.createObjectURL(element.files[ 0 ]);
}

JOB.SetImageCallback(function (result) { console.log(result); });

Any idea ?

Thanks.

Error on StreamDemo.html

Hi Eddie ,
Thank you for the work you do .
In http://eddiela.github.io/JOB/StreamDemo.html pressing Start decoding ,
Chrome jumps error:
Uncaught TypeError : Can not read property ' drawImage ' of undefinedJOB.js : 177 JOB.JOBStreamCallback .

The JOB.SearchCanvas variable is undefined .
You know it can be ?

Thanks for everything.
Alberto .

Code 39 special character not reading

In case of code 39 i have got some error while reading a barcode
like in case of %158198 result is 58198
2) in case of WIKIPEDIA
result is WIKIPEDIA

How i exactly detect the code

Mobile browser

I've tested in my mobile browser (iPhone + Chrome) but, i don't get the result. Is this a browser issue?

Fixed parameters (width/height)

Hi EddieLa,

integrated your JOB into my application and did some first tests. Works fine and the localization output looks nice. But I had some trouble getting the output right. You used a fixed canvas with 320x240px for showing your localization result and also within your JOB.js the canvas is limited to 640x480px. Maybe it might be interesting to parameterize this somehow. When playing with resolution sizes or allowing vertical images (480x640px).

Will test it soon with the Muenster BarcodeDB, too.

not an issue

Not an issue, just wanted to tell you that you are great! :D Keep on that work, I did look for something like this months ago and found - nothing - except ZBar. I think JS is powerful enought, but I didn't know much about barcode recognition to write something like this myself. You are great, thanks for sharing!

can be closed. ;o)

front camera on startdecoding

I am working on a webapplication by following your https://github.com/EddieLa/JOB . it is an excellent work I have been looking for a mobile browser scanner since once week and found this one I have integrated into asp.net web application hosted on iis and tried to browse it on android mobile on chrome it opens up front camera a try to find code can you please help me if there is a way to trigger the scanner on button click your help is soo much appreciated.
and is there a way to open back camera of the mobile by any chance.

Problem with Code 39 decoding

Hi. I'm having problems with decoding Code 39 barcodes if they're not absolutely pristine.

Though, they'll successfully decode using the online test tool at http://zxing.org/w/decode.jspx

Here's the only one I've been able to successfully get the lib to do:
https://decalrestore.files.wordpress.com/2013/01/1996-07-bar-code-decal1.png

Here are some that fail (but work on zxing).
http://images.gtcarlot.com/pictures/57758092.jpg
http://www.e90post.com/forums/e90garageimg/563/BMW%20VIN%20small.JPG

NullPointerExeption

JOB/src/DecoderWorker.js on Line 453:
newTable[0].length throws an error, when newTable is an empty array, therefore no newTable[0] exists. Fixed this with a simple condition:

if (newTable.length > 0) {
Image.table = newTable;
Image.width = newTable.length;
Image.height = newTable[0].length;
CreateImageData();
allTables.push({ table: newTable, data: new Uint8ClampedArray(Image.data), width: Image.width, height: Image.height });
}

This happened with image #102 of Muenster BarcodeDB (EAN: 4-000417-106001, Image: 4000417106001-01_N95-2592x1944_scaledTo800x600bilinear.jpg)

Result

Eddie
I hope you will excuse my ignorance.
Your barcode reader is excellent and I would like to use it as part of another project I am working on which utilises the Factual product catalogue.
How to I capture the output (resulting string) from your code so that I may use it as a string input for a search. I.e. How do I pass the result from your script to a string$?

unable to get project to show image/decode

I have downloaded the code and I'm trying to get this working locally. I can get the page to load and I can select/capture an image but the canvas for the image doesnt show and its not displaying a barcode. I have downloaded the ZIP for JOB-gh-pages (trying the index.html) as well as the JOB.git (trying the reader.html in the src folder).

Are there additional steps required to make this operational? I have looked for a step by step guide to implementation but I couldn't find one.

Any suggestions?

Issue on Iphone

Camera not loading in IOS, getUserMedia not calling the camera alert? Could you let me know whether it support mobile devices?

Mobile performance?

I'm developing for a barcode web app, and while everything runs great on firefox & chrome on my computer, reading seems hit or miss on android (jelly bean) chrome, and barely works on iOS devices (4S, 5, iPad 4) on chrome or safari in iOS 6 & 7. I based those tests off your demo page, and it was happening consistantly across all devices I tried.

Keyboard wedge

Hello, how can I detect and wedge the scanner, so that I can capture the input scans.

Image always rescaled?

Somewhere in the deep dark depths of the code any image processed is being rescaled to 320x240. This is causing moire patterns in some barcodes rendering them un-decodable. Is there a way to disable this, or is it there for some specific reason?

d.ts file?

I'm wondering... has anyone done a typescript d.ts file for this yet? If so I'd love to get a copy before I try this out. Unless I made a mistake, I couldn't find one on definitely typed...

stream demo doesn't show result !!

seems like the callback is not responding at all .
just tried that in streamdemo.html
JOB.StreamCallback = function(result) {
console.log('test call back ')
if(result.length > 0){
var tempArray = [];
for(var i = 0; i < result.length; i++) {
tempArray.push(result[i].Format+" : "+result[i].Value);
}
Result.innerHTML=tempArray.join("
");
}
};
but the console didnt log any thing

Pass Image URLs

I want to pass image URL for Decode data from barcode. How do i pass URL instead of selecting image?

Uncaught ReferenceError: root is not defined

I get error Uncaught ReferenceError: root is not defined in file DecoderWorker.js:2968

There is this code:
root.decoderWorkerBlobString = decoderWorkerBlobString;
How can I fix it?
Thanks.

Mobile decoding issue

After some debugging I realized that the Barcode Reader/Uploader has issues on mobile devices because of the image's default orientation, not resolution.

http://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/

For example, if you take a picture with an iOs Device in Portrait mode, the image is given the orientation 6 by default, which is 90 degrees CCW.
My android device is rotating it 90 degrees CW.

When uploaded to the reader, it fails out because the decoder is try to decode an image 90 CCW.

Perhaps integrating this:
https://github.com/blueimp/JavaScript-Load-Image

Stackoverflow with more info:
http://stackoverflow.com/questions/20600800/js-client-side-exif-orientation-rotate-and-mirror-jpeg-images

Would solve it?

Diagonals

Thank you so much for your work on this.

I have a 1D Code39 barcode that http://online-barcode-reader.inliteresearch.com/ properly decodes, but if I run your script it gives an error. (Your script can decode other barcodes perfectly.)

The only difference I can pinpoint between the successful and unsuccessful images is that the unsuccessful one is on a slight diagonal while the successful images are straight across. (The website above has a "rotation" indicator that says "diagonal" on my unsuccessful image and "none" on the rest.)

Code128 discrepancy

Hi,

We are using this library for image capture and works almost very good except for code 128 barcodes not being scanned properly.
If you can check it , it would be of great help so that we can test it again and push the code to prod.

The decoding fails for code128 in the demo page too. http://eddiela.github.io/JOB/

Also the live streaming demo isnt scanning any barcodes. Also when the demo is tried on mobile it opens the front camera only.

Thanks!

Problems decoding scanned image from scanner

barcode with more than 5 degree rotation will not decode..
Any chance of improving the algorithm?
image captured by camera success decode rate higher than using scanner. Is it normal?

Uncaught ReferenceError: require is not defined

hi fellows,

i am newbie with node, and wanted to use your project but i think i don't have the right environment to run it or something ! so if you can tell me how to import your project and use it in localhost i will be thankful.

1.6.1 example doesn't work...

Trying to review the changes in 1.6.1, however the Reader.html in the src folder fails to load, throwing various javascript errors. Main problem was that jQuery wasn't loaded, but after adding a call to it in the head I am still seeing....

"Uncaught ReferenceError: BarcodeReader is not defined" at line 45 in "barcode-reader.jquery.js"

I've tried a few things, but seem unable to diagnose the problem. Any assistance would be appreciated.

Commented source code / algorithm description?

Is there any chance to get some good comments in your source code or a basic description of the algorithms you're using? I'm impressed with your success in reading barcodes but I'm having a tough time understanding what's going on behind the scenes. I'd like to be able to springboard off some of what you're doing for my own application.

I'm not that interested in the detection/straightening. My application assumes there's a single barcode in the viewfinder and scans directly across the center of it. I would appreciate anything you could offer in regards to thresholding/binarizing and accurately reading the bars. Decoding isn't too hard as long as the data is good.

Thanks!

Adding One Charecter extra to the actual barcode

hi,
i'm using this library and i',m trying too read vin numbers its reads almost accurately,thanks for that but sometimes one character extra is added to the actual code can anyone help me.
thanks in advance.

Code39 Decoding does not always work

Consider the following images:

1)
002298

2)
test2

3)
test

1 works without issues, but 2 and 3 do not. I'm guessing the decoder is unable to cope with the additional image details surrounding the barcode. Is that something that can be fixed in the algorithm or is there a recommended work around?

Contrast + Binary does not handle low light well

The combination of contrast and binary does not really handle low-light images.

A better approach is in https://gist.github.com/tobytailor/421369, which is to find the minimum and the maximum and use the average as a threshold.

I replaced them with a single function:

function contrastBinary(data) {
    var min = 127 * 3;
    var max = 128 * 3;
    for (var i = 0, len = Image.width * Image.height * 4; i < len; i += 4) {
        var val = data[i] + data[i + 1] + data[i + 2];
        if (val < min) {
            min = val;
        } else if (val > max) {
            max = val;
        }
    }
    var threshold = (max + min) / 2;
    for (var i = 0, len = Image.width * Image.height * 4; i < len; i += 4) {
        ave = (data[i] + data[i + 1] + data[i + 2]);
        if (ave < threshold) {
            data[i] = data[i + 1] = data[i + 2] = 0;
        } else {
            data[i] = data[i + 1] = data[i + 2] = 255;
        }
        data[i + 3] = 255;
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.