mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-12 21:21:42 +08:00
#49: Added sample static images
This commit is contained in:
@@ -43,6 +43,7 @@
|
|||||||
<option value="upc">UPC</option>
|
<option value="upc">UPC</option>
|
||||||
<option value="upc_e">UPC-E</option>
|
<option value="upc_e">UPC-E</option>
|
||||||
<option value="codabar">Codabar</option>
|
<option value="codabar">Codabar</option>
|
||||||
|
<option value="i2of5">I2of5</option>
|
||||||
</select>
|
</select>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,14 +1,39 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
var App = {
|
var App = {
|
||||||
init: function() {
|
init: function() {
|
||||||
Quagga.init(this.state, function() {
|
var config = this.config[this.state.decoder.readers[0]] || this.config.default;
|
||||||
|
config = $.extend(true, {}, config, this.state);
|
||||||
|
Quagga.init(config, function() {
|
||||||
App.attachListeners();
|
App.attachListeners();
|
||||||
Quagga.start();
|
Quagga.start();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
reader: "code_128",
|
"default": {
|
||||||
length: 10
|
inputStream: { name: "Test",
|
||||||
|
type: "ImageStream",
|
||||||
|
length: 10,
|
||||||
|
size: 800
|
||||||
|
},
|
||||||
|
locator: {
|
||||||
|
patchSize: "medium",
|
||||||
|
halfSample: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"i2of5_reader": {
|
||||||
|
inputStream: {
|
||||||
|
size: 800,
|
||||||
|
type: "ImageStream",
|
||||||
|
length: 5
|
||||||
|
},
|
||||||
|
locator: {
|
||||||
|
patchSize: "small",
|
||||||
|
halfSample: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getState: function(reader) {
|
||||||
|
return this.config[reader] || this.config.default;
|
||||||
},
|
},
|
||||||
attachListeners: function() {
|
attachListeners: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
@@ -58,6 +83,7 @@ $(function() {
|
|||||||
|
|
||||||
paths.forEach(function(path) {
|
paths.forEach(function(path) {
|
||||||
var mappedValue;
|
var mappedValue;
|
||||||
|
|
||||||
if (typeof self._accessByPath(self.inputMapper, path) === "function") {
|
if (typeof self._accessByPath(self.inputMapper, path) === "function") {
|
||||||
mappedValue = self._accessByPath(self.inputMapper, path)(value);
|
mappedValue = self._accessByPath(self.inputMapper, path)(value);
|
||||||
}
|
}
|
||||||
@@ -82,10 +108,8 @@ $(function() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
state: {
|
state: {
|
||||||
inputStream: { name: "Test",
|
inputStream: {
|
||||||
type: "ImageStream",
|
|
||||||
src: "../test/fixtures/code_128/",
|
src: "../test/fixtures/code_128/",
|
||||||
length: 10
|
|
||||||
},
|
},
|
||||||
decoder : {
|
decoder : {
|
||||||
readers : ["code_128_reader"]
|
readers : ["code_128_reader"]
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 137 KiB |
Vendored
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 714 KiB After Width: | Height: | Size: 137 KiB |
Vendored
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 633 KiB After Width: | Height: | Size: 714 KiB |
Vendored
BIN
Binary file not shown.
|
After Width: | Height: | Size: 633 KiB |
Reference in New Issue
Block a user