Open YeisonVelez11 opened 6 years ago
have you ever fix this problem?
I can say without a doubt that the second one in this sample is due to lack of whitespace -- adding a 25px whitespace around it should fix it.
That said, I'm not good enough to be able to determine what format a barcode is in by just looking at it, but it's my assumption that the first one is either failing due to the same reason -- needs more whitespace, or failing because it's not code128 format.
@hcrufio88 probably could use more information about your configuration and samples to determine what's failing for you
Thanks I really appreciate your work. I fix the previous issue and the function works fine. Now I have another problem. WHY this code ends always with the same code?!? if I scan only a code it works, but in a for or forEach loop it gives me always one code for all.
const Quagga = require('quagga').default;
const idPratiche = [];
const filedir = [
'./temp/crop-0.jpg',
'./temp/crop-1.jpg',
'./temp/crop-2.jpg',
'./temp/crop-3.jpg'
]
filedir.forEach(function(file){
Quagga.decodeSingle({
src: file,
numOfWorkers: 0,
locate:true,
locator:{patchSize:"large",halfSample:true}, // Needs to be 0 when used within node
inputStream: {
size: 800 // restrict input-size to be 800px in width (long-side)
},
decoder: {
readers: ["ean_reader"] // List of active readers
},
}, function(result) {
if(result.codeResult) {
console.log(result.codeResult.code);
let res = +(result.codeResult.code.substring(6, 12));
let id = {fileName:file,id:res}
idPratiche.push(id);
console.log(idPratiche);
} else {
let id = {fileName:file,id:"not detected"}
idPratiche.push(id);
}
});
});
Decoding in parallel does not work here. I am trying to fix that here https://github.com/ericblade/quagga2/pull/171
I could definitely use some additional eyes and tests on how well that works, if it works correctly.
I try to use quagga 2 but I can't make it work.
const Quagga = require('@ericblade/quagga2').default;
let path= "./crop-0.jpg"
Quagga.decodeSingle({
src: path,
numOfWorkers: 0,
locate:true,
locator:{patchSize:"large",halfSample:true}, // Needs to be 0 when used within node
inputStream: {
size: 800 // restrict input-size to be 800px in width (long-side)
},
decoder: {
readers: ["ean_reader"] // List of active readers
},
}, function(result) {
if(result.codeResult) {
var res = +(result.codeResult.code.substring(6, 12));
var id = {fileName:path,id:res}
console.log(id);
} else {
console.log("not detected");
}
});
the result of that in node 12.16.1 is:
I only install the nom package with
npm install --save @ericblade/quagga2
it seems i have somehow 'fixed' it so that it should be just require('@ericblade/quagga2') rather than require(...).default .. that wasn't intentional, but i'm not sure what change did it, right off..
you'd also have to use a custom built one with that pull request, until i'm comfortable releasing that patch, which might take a little while, because it makes a lot of internal changes that need to be run out in real use for a while i think
Hi friends, I congratulate you on this amazing plugin. In my case it does not work with any of the 2 images I have. What can I do to detect them?
` var Quagga = require('quagga').default;
`