preparing ean-extended release

feature/71
Christoph Oberhofer 9 years ago
parent 8fa0c69bc1
commit af3c505882

@ -46,6 +46,7 @@
<option value="code_39">Code 39</option>
<option value="code_39_vin">Code 39 VIN</option>
<option value="ean">EAN</option>
<option value="ean_extended">EAN-extended</option>
<option value="ean_8">EAN-8</option>
<option value="upc">UPC</option>
<option value="upc_e">UPC-E</option>

@ -82,21 +82,37 @@ $(function() {
},
decoder: {
readers: function(value) {
return [value + "_reader"];
if (value === 'ean_extended') {
return [{
format: "ean_reader",
config: {
supplements: [
'ean_5_reader', 'ean_2_reader'
]
}
}];
}
return [{
format: value + "_reader",
config: {}
}];
}
}
},
state: {
inputStream: {
size: 640,
size: 800,
singleChannel: false
},
locator: {
patchSize: "large",
halfSample: false
patchSize: "medium",
halfSample: true
},
decoder: {
readers: ["code_128_reader"]
readers: [{
format: "code_128_reader",
config: {}
}]
},
locate: true,
src: null

@ -38,6 +38,7 @@
<option value="code_39">Code 39</option>
<option value="code_39_vin">Code 39 VIN</option>
<option value="ean">EAN</option>
<option value="ean_extended">EAN-extended</option>
<option value="ean_8">EAN-8</option>
<option value="upc">UPC</option>
<option value="upc_e">UPC-E</option>

@ -107,7 +107,20 @@ $(function() {
},
decoder: {
readers: function(value) {
return [value + "_reader"];
if (value === 'ean_extended') {
return [{
format: "ean_reader",
config: {
supplements: [
'ean_5_reader', 'ean_2_reader'
]
}
}];
}
return [{
format: value + "_reader",
config: {}
}];
}
}
},
@ -126,7 +139,10 @@ $(function() {
},
numOfWorkers: 4,
decoder: {
readers : [ "code_128_reader"]
readers : [{
format: "code_128_reader",
config: {}
}]
},
locate: true
},

@ -39,6 +39,7 @@
<option value="code_39">Code 39</option>
<option value="code_39_vin">Code 39 VIN</option>
<option value="ean">EAN</option>
<option value="ean_extended">EAN-extended</option>
<option value="ean_8">EAN-8</option>
<option value="upc">UPC</option>
<option value="upc_e">UPC-E</option>

@ -1,7 +1,7 @@
$(function() {
var App = {
init: function() {
var config = this.config[this.state.decoder.readers[0]] || this.config.default;
var config = this.config[this.state.decoder.readers[0].format] || this.config.default;
config = $.extend(true, {}, config, this.state);
Quagga.init(config, function() {
App.attachListeners();
@ -95,7 +95,20 @@ $(function() {
inputMapper: {
decoder: {
readers: function(value) {
return [value + "_reader"];
if (value === 'ean_extended') {
return [{
format: "ean_reader",
config: {
supplements: [
'ean_5_reader', 'ean_2_reader'
]
}
}];
}
return [{
format: value + "_reader",
config: {}
}];
}
},
inputStream: {
@ -109,7 +122,10 @@ $(function() {
src: "../test/fixtures/code_128/"
},
decoder : {
readers : ["code_128_reader"]
readers : [{
format: "code_128_reader",
config: {}
}]
}
}
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 869 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

@ -27,15 +27,19 @@ describe('decodeSingle', function () {
function _runTestSet(testSet, config) {
var readers = config.decoder.readers.slice(),
format,
folder;
folder,
suffix;
if (typeof readers[0] === 'string'){
format = readers[0];
} else {
if (readers[0].config && readers[0].config.supplements && readers[0].config.supplements.length) {
suffix = "extended";
}
format = readers[0].format;
}
folder = baseFolder + format.split('_').slice(0, -1).join('_') + "/";
folder = baseFolder + format.split('_').slice(0, -1).concat(suffix ? [suffix] : []).join('_') + "/";
it('should decode ' + folder + " correctly", function(done) {
async.eachSeries(testSet, function (sample, callback) {
@ -76,6 +80,49 @@ describe('decodeSingle', function () {
_runTestSet(testSet, config);
});
describe("EAN-extended", function() {
var config = {
inputStream: {
size: 800,
singleChannel: false
},
locator: {
patchSize: "medium",
halfSample: true
},
numOfWorkers: 0,
decoder: {
readers: [{
format: "ean_reader",
config: {
supplements: [
'ean_5_reader', 'ean_2_reader'
]
}
}]
},
locate: true,
src: null
},
testSet = [
{"name": "image-001.jpg", "result": "900437801102701"},
{"name": "image-002.jpg", "result": "419871600890101"},
{"name": "image-003.jpg", "result": "419871600890101"},
{"name": "image-004.jpg", "result": "978054466825652495"},
{"name": "image-005.jpg", "result": "419664190890712"},
{"name": "image-006.jpg", "result": "412056690699101"},
{"name": "image-007.jpg", "result": "419204531290601"},
{"name": "image-008.jpg", "result": "419871600890101"},
{"name": "image-009.jpg", "result": "978054466825652495"},
{"name": "image-010.jpg", "result": "900437801102701"}
];
testSet.forEach(function(sample) {
sample.format = "ean_13";
});
_runTestSet(testSet, config);
});
describe("Code128", function() {
var config = {
inputStream: {

Loading…
Cancel
Save