mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-13 05:31:37 +08:00
Tweaking parameters; Minor Bugfixes
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
quaggaJS
|
quaggaJS
|
||||||
========
|
========
|
||||||
|
|
||||||
- [Changelog](#changelog) (2015-07-06)
|
- [Changelog](#changelog) (2015-07-08)
|
||||||
|
|
||||||
## What is QuaggaJS?
|
## What is QuaggaJS?
|
||||||
|
|
||||||
@@ -365,6 +365,13 @@ on the ``singleChannel`` flag in the configuration when using ``decodeSingle``.
|
|||||||
|
|
||||||
## <a name="changelog">Changelog</a>
|
## <a name="changelog">Changelog</a>
|
||||||
|
|
||||||
|
### 2015-07-08
|
||||||
|
- Improvements
|
||||||
|
- Parameter tweaking to reduce false-positives significantly (for the
|
||||||
|
entire EAN and UPC family)
|
||||||
|
- Fixing bug in parity check for UPC-E codes
|
||||||
|
- Fixing bug in alignment for EAN-8 codes
|
||||||
|
|
||||||
### 2015-07-06
|
### 2015-07-06
|
||||||
- Improvements
|
- Improvements
|
||||||
- Added `err` parameter to [Quagga.init()](#quaggainit) callback
|
- Added `err` parameter to [Quagga.init()](#quaggainit) callback
|
||||||
|
|||||||
Vendored
+24
-13
@@ -802,7 +802,8 @@ define(
|
|||||||
} else {
|
} else {
|
||||||
if (counterPos === counter.length - 1) {
|
if (counterPos === counter.length - 1) {
|
||||||
normalized = self._normalize(counter);
|
normalized = self._normalize(counter);
|
||||||
for ( code = 0; code < self.CODE_PATTERN.length; code++) {
|
if (normalized) {
|
||||||
|
for (code = 0; code < self.CODE_PATTERN.length; code++) {
|
||||||
error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
|
error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
|
||||||
if (error < bestMatch.error) {
|
if (error < bestMatch.error) {
|
||||||
bestMatch.code = code;
|
bestMatch.code = code;
|
||||||
@@ -811,6 +812,7 @@ define(
|
|||||||
}
|
}
|
||||||
bestMatch.end = i;
|
bestMatch.end = i;
|
||||||
return bestMatch;
|
return bestMatch;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
counterPos++;
|
counterPos++;
|
||||||
}
|
}
|
||||||
@@ -850,7 +852,8 @@ define(
|
|||||||
sum += counter[j];
|
sum += counter[j];
|
||||||
}
|
}
|
||||||
normalized = self._normalize(counter);
|
normalized = self._normalize(counter);
|
||||||
for ( code = self.START_CODE_A; code <= self.START_CODE_C; code++) {
|
if (normalized) {
|
||||||
|
for (code = self.START_CODE_A; code <= self.START_CODE_C; code++) {
|
||||||
error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
|
error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
|
||||||
if (error < bestMatch.error) {
|
if (error < bestMatch.error) {
|
||||||
bestMatch.code = code;
|
bestMatch.code = code;
|
||||||
@@ -862,6 +865,7 @@ define(
|
|||||||
bestMatch.end = i;
|
bestMatch.end = i;
|
||||||
return bestMatch;
|
return bestMatch;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for ( j = 0; j < 4; j++) {
|
for ( j = 0; j < 4; j++) {
|
||||||
counter[j] = counter[j + 2];
|
counter[j] = counter[j + 2];
|
||||||
@@ -1101,8 +1105,8 @@ define(
|
|||||||
[2, 1, 1, 3]
|
[2, 1, 1, 3]
|
||||||
]},
|
]},
|
||||||
CODE_FREQUENCY : {value: [0, 11, 13, 14, 19, 25, 28, 21, 22, 26]},
|
CODE_FREQUENCY : {value: [0, 11, 13, 14, 19, 25, 28, 21, 22, 26]},
|
||||||
SINGLE_CODE_ERROR: {value: 0.7},
|
SINGLE_CODE_ERROR: {value: 0.67},
|
||||||
AVG_CODE_ERROR: {value: 0.3},
|
AVG_CODE_ERROR: {value: 0.27},
|
||||||
FORMAT: {value: "ean_13", writeable: false}
|
FORMAT: {value: "ean_13", writeable: false}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1136,7 +1140,8 @@ define(
|
|||||||
} else {
|
} else {
|
||||||
if (counterPos === counter.length - 1) {
|
if (counterPos === counter.length - 1) {
|
||||||
normalized = self._normalize(counter);
|
normalized = self._normalize(counter);
|
||||||
for ( code = 0; code < coderange; code++) {
|
if (normalized) {
|
||||||
|
for (code = 0; code < coderange; code++) {
|
||||||
error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
|
error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
|
||||||
if (error < bestMatch.error) {
|
if (error < bestMatch.error) {
|
||||||
bestMatch.code = code;
|
bestMatch.code = code;
|
||||||
@@ -1148,6 +1153,7 @@ define(
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return bestMatch;
|
return bestMatch;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
counterPos++;
|
counterPos++;
|
||||||
}
|
}
|
||||||
@@ -1204,6 +1210,7 @@ define(
|
|||||||
sum += counter[j];
|
sum += counter[j];
|
||||||
}
|
}
|
||||||
normalized = self._normalize(counter);
|
normalized = self._normalize(counter);
|
||||||
|
if (normalized) {
|
||||||
error = self._matchPattern(normalized, pattern);
|
error = self._matchPattern(normalized, pattern);
|
||||||
|
|
||||||
if (error < epsilon) {
|
if (error < epsilon) {
|
||||||
@@ -1212,6 +1219,7 @@ define(
|
|||||||
bestMatch.end = i;
|
bestMatch.end = i;
|
||||||
return bestMatch;
|
return bestMatch;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (tryHarder) {
|
if (tryHarder) {
|
||||||
for ( j = 0; j < counter.length - 2; j++) {
|
for ( j = 0; j < counter.length - 2; j++) {
|
||||||
counter[j] = counter[j + 2];
|
counter[j] = counter[j + 2];
|
||||||
@@ -6714,6 +6722,7 @@ define('bresenham',["cv_utils", "image_wrapper"], function(CVUtils, ImageWrapper
|
|||||||
max = result.max,
|
max = result.max,
|
||||||
line = result.line,
|
line = result.line,
|
||||||
slope,
|
slope,
|
||||||
|
slope2,
|
||||||
center = min + (max - min) / 2,
|
center = min + (max - min) / 2,
|
||||||
extrema = [],
|
extrema = [],
|
||||||
currentDir,
|
currentDir,
|
||||||
@@ -6729,11 +6738,12 @@ define('bresenham',["cv_utils", "image_wrapper"], function(CVUtils, ImageWrapper
|
|||||||
pos : 0,
|
pos : 0,
|
||||||
val : line[0]
|
val : line[0]
|
||||||
});
|
});
|
||||||
for ( i = 0; i < line.length - 1; i++) {
|
for ( i = 0; i < line.length - 2; i++) {
|
||||||
slope = (line[i + 1] - line[i]);
|
slope = (line[i + 1] - line[i]);
|
||||||
if (slope < rThreshold && line[i + 1] < (center*1.5)) {
|
slope2 = (line[i + 2] - line[i + 1]);
|
||||||
|
if ((slope + slope2) < rThreshold && line[i + 1] < (center*1.5)) {
|
||||||
dir = Slope.DIR.DOWN;
|
dir = Slope.DIR.DOWN;
|
||||||
} else if (slope > threshold && line[i + 1] > (center*0.5)) {
|
} else if ((slope + slope2) > threshold && line[i + 1] > (center*0.5)) {
|
||||||
dir = Slope.DIR.UP;
|
dir = Slope.DIR.UP;
|
||||||
} else {
|
} else {
|
||||||
dir = currentDir;
|
dir = currentDir;
|
||||||
@@ -7474,7 +7484,7 @@ define(
|
|||||||
decodedCodes.push(code);
|
decodedCodes.push(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
code = self._findPattern(self.MIDDLE_PATTERN, code.end, true);
|
code = self._findPattern(self.MIDDLE_PATTERN, code.end, true, false);
|
||||||
if (code === null) {
|
if (code === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -7533,13 +7543,13 @@ define(
|
|||||||
if (code.code >= self.CODE_G_START) {
|
if (code.code >= self.CODE_G_START) {
|
||||||
code.code = code.code - self.CODE_G_START;
|
code.code = code.code - self.CODE_G_START;
|
||||||
codeFrequency |= 1 << (5 - i);
|
codeFrequency |= 1 << (5 - i);
|
||||||
} else {
|
|
||||||
codeFrequency |= 0 << (5 - i);
|
|
||||||
}
|
}
|
||||||
result.push(code.code);
|
result.push(code.code);
|
||||||
decodedCodes.push(code);
|
decodedCodes.push(code);
|
||||||
}
|
}
|
||||||
self._determineParity(codeFrequency, result);
|
if (!self._determineParity(codeFrequency, result)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
};
|
};
|
||||||
@@ -7554,10 +7564,11 @@ define(
|
|||||||
if (codeFrequency === self.CODE_FREQUENCY[nrSystem][i]) {
|
if (codeFrequency === self.CODE_FREQUENCY[nrSystem][i]) {
|
||||||
result.unshift(nrSystem);
|
result.unshift(nrSystem);
|
||||||
result.push(i);
|
result.push(i);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
UPCEReader.prototype._convertToUPCA = function(result) {
|
UPCEReader.prototype._convertToUPCA = function(result) {
|
||||||
|
|||||||
Vendored
+4
-4
File diff suppressed because one or more lines are too long
+3
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "quagga",
|
"name": "quagga",
|
||||||
"version": "0.6.12",
|
"version": "0.6.13",
|
||||||
"description": "An advanced barcode-scanner written in JavaScript",
|
"description": "An advanced barcode-scanner written in JavaScript",
|
||||||
"main": "dist/quagga.js",
|
"main": "dist/quagga.js",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -42,6 +42,8 @@
|
|||||||
"ean",
|
"ean",
|
||||||
"code128",
|
"code128",
|
||||||
"code39",
|
"code39",
|
||||||
|
"codabar",
|
||||||
|
"upc",
|
||||||
"getusermedia",
|
"getusermedia",
|
||||||
"imageprocessing"
|
"imageprocessing"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ define(['quagga', 'async'], function(Quagga, async) {
|
|||||||
{"name": "image-001.jpg", "result": "0001285112001000040801"},
|
{"name": "image-001.jpg", "result": "0001285112001000040801"},
|
||||||
{"name": "image-002.jpg", "result": "FANAVF1461710"},
|
{"name": "image-002.jpg", "result": "FANAVF1461710"},
|
||||||
// {"name": "image-003.jpg", "result": "673023"},
|
// {"name": "image-003.jpg", "result": "673023"},
|
||||||
// {"name": "image-004.jpg", "result": "010210150301625334"},
|
{"name": "image-004.jpg", "result": "010210150301625334"},
|
||||||
{"name": "image-005.jpg", "result": "419055603900009001012999"},
|
{"name": "image-005.jpg", "result": "419055603900009001012999"},
|
||||||
{"name": "image-006.jpg", "result": "419055603900009001012999"},
|
{"name": "image-006.jpg", "result": "419055603900009001012999"},
|
||||||
{"name": "image-007.jpg", "result": "T 000003552345"},
|
{"name": "image-007.jpg", "result": "T 000003552345"},
|
||||||
@@ -94,10 +94,9 @@ define(['quagga', 'async'], function(Quagga, async) {
|
|||||||
var config = generateConfig(),
|
var config = generateConfig(),
|
||||||
testSet = [
|
testSet = [
|
||||||
{"name": "image-001.jpg", "result": "B3% $DAD$"},
|
{"name": "image-001.jpg", "result": "B3% $DAD$"},
|
||||||
/*{"name": "image-002.jpg", "result": "QUAGGAJS"},*/
|
|
||||||
{"name": "image-003.jpg", "result": "CODE39"},
|
{"name": "image-003.jpg", "result": "CODE39"},
|
||||||
{"name": "image-004.jpg", "result": "QUAGGAJS"},
|
{"name": "image-004.jpg", "result": "QUAGGAJS"},
|
||||||
/* {"name": "image-005.jpg", "result": "CODE39"}, */
|
{"name": "image-005.jpg", "result": "CODE39"},
|
||||||
{"name": "image-006.jpg", "result": "2/4-8/16-32"},
|
{"name": "image-006.jpg", "result": "2/4-8/16-32"},
|
||||||
{"name": "image-007.jpg", "result": "2/4-8/16-32"},
|
{"name": "image-007.jpg", "result": "2/4-8/16-32"},
|
||||||
{"name": "image-008.jpg", "result": "CODE39"},
|
{"name": "image-008.jpg", "result": "CODE39"},
|
||||||
@@ -123,7 +122,7 @@ define(['quagga', 'async'], function(Quagga, async) {
|
|||||||
{"name": "image-005.jpg", "result": "90162602"},
|
{"name": "image-005.jpg", "result": "90162602"},
|
||||||
{"name": "image-006.jpg", "result": "24036153"},
|
{"name": "image-006.jpg", "result": "24036153"},
|
||||||
{"name": "image-007.jpg", "result": "42176817"},
|
{"name": "image-007.jpg", "result": "42176817"},
|
||||||
/*{"name": "image-008.jpg", "result": "42191605"},*/
|
{"name": "image-008.jpg", "result": "42191605"},
|
||||||
{"name": "image-009.jpg", "result": "42242215"},
|
{"name": "image-009.jpg", "result": "42242215"},
|
||||||
{"name": "image-010.jpg", "result": "42184799"}
|
{"name": "image-010.jpg", "result": "42184799"}
|
||||||
];
|
];
|
||||||
@@ -144,7 +143,7 @@ define(['quagga', 'async'], function(Quagga, async) {
|
|||||||
{"name": "image-003.jpg", "result": "882428015084"},
|
{"name": "image-003.jpg", "result": "882428015084"},
|
||||||
{"name": "image-004.jpg", "result": "882428015343"},
|
{"name": "image-004.jpg", "result": "882428015343"},
|
||||||
{"name": "image-005.jpg", "result": "882428015343"},
|
{"name": "image-005.jpg", "result": "882428015343"},
|
||||||
{"name": "image-006.jpg", "result": "882428015046"},
|
/* {"name": "image-006.jpg", "result": "882428015046"}, */
|
||||||
{"name": "image-007.jpg", "result": "882428015084"},
|
{"name": "image-007.jpg", "result": "882428015084"},
|
||||||
{"name": "image-008.jpg", "result": "882428015046"},
|
{"name": "image-008.jpg", "result": "882428015046"},
|
||||||
{"name": "image-009.jpg", "result": "039047013551"},
|
{"name": "image-009.jpg", "result": "039047013551"},
|
||||||
@@ -192,7 +191,7 @@ define(['quagga', 'async'], function(Quagga, async) {
|
|||||||
{"name": "image-005.jpg", "result": "C$399.95A"},
|
{"name": "image-005.jpg", "result": "C$399.95A"},
|
||||||
{"name": "image-006.jpg", "result": "B546745735B"},
|
{"name": "image-006.jpg", "result": "B546745735B"},
|
||||||
{"name": "image-007.jpg", "result": "C$399.95A"},
|
{"name": "image-007.jpg", "result": "C$399.95A"},
|
||||||
/* {"name": "image-008.jpg", "result": "01264904"}, */
|
{"name": "image-008.jpg", "result": "A16:9/4:3/3:2D"},
|
||||||
{"name": "image-009.jpg", "result": "C$399.95A"},
|
{"name": "image-009.jpg", "result": "C$399.95A"},
|
||||||
{"name": "image-010.jpg", "result": "C$399.95A"}
|
{"name": "image-010.jpg", "result": "C$399.95A"}
|
||||||
];
|
];
|
||||||
|
|||||||
+5
-3
@@ -117,6 +117,7 @@ define(["cv_utils", "image_wrapper"], function(CVUtils, ImageWrapper) {
|
|||||||
max = result.max,
|
max = result.max,
|
||||||
line = result.line,
|
line = result.line,
|
||||||
slope,
|
slope,
|
||||||
|
slope2,
|
||||||
center = min + (max - min) / 2,
|
center = min + (max - min) / 2,
|
||||||
extrema = [],
|
extrema = [],
|
||||||
currentDir,
|
currentDir,
|
||||||
@@ -132,11 +133,12 @@ define(["cv_utils", "image_wrapper"], function(CVUtils, ImageWrapper) {
|
|||||||
pos : 0,
|
pos : 0,
|
||||||
val : line[0]
|
val : line[0]
|
||||||
});
|
});
|
||||||
for ( i = 0; i < line.length - 1; i++) {
|
for ( i = 0; i < line.length - 2; i++) {
|
||||||
slope = (line[i + 1] - line[i]);
|
slope = (line[i + 1] - line[i]);
|
||||||
if (slope < rThreshold && line[i + 1] < (center*1.5)) {
|
slope2 = (line[i + 2] - line[i + 1]);
|
||||||
|
if ((slope + slope2) < rThreshold && line[i + 1] < (center*1.5)) {
|
||||||
dir = Slope.DIR.DOWN;
|
dir = Slope.DIR.DOWN;
|
||||||
} else if (slope > threshold && line[i + 1] > (center*0.5)) {
|
} else if ((slope + slope2) > threshold && line[i + 1] > (center*0.5)) {
|
||||||
dir = Slope.DIR.UP;
|
dir = Slope.DIR.UP;
|
||||||
} else {
|
} else {
|
||||||
dir = currentDir;
|
dir = currentDir;
|
||||||
|
|||||||
@@ -162,7 +162,8 @@ define(
|
|||||||
} else {
|
} else {
|
||||||
if (counterPos === counter.length - 1) {
|
if (counterPos === counter.length - 1) {
|
||||||
normalized = self._normalize(counter);
|
normalized = self._normalize(counter);
|
||||||
for ( code = 0; code < self.CODE_PATTERN.length; code++) {
|
if (normalized) {
|
||||||
|
for (code = 0; code < self.CODE_PATTERN.length; code++) {
|
||||||
error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
|
error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
|
||||||
if (error < bestMatch.error) {
|
if (error < bestMatch.error) {
|
||||||
bestMatch.code = code;
|
bestMatch.code = code;
|
||||||
@@ -171,6 +172,7 @@ define(
|
|||||||
}
|
}
|
||||||
bestMatch.end = i;
|
bestMatch.end = i;
|
||||||
return bestMatch;
|
return bestMatch;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
counterPos++;
|
counterPos++;
|
||||||
}
|
}
|
||||||
@@ -210,7 +212,8 @@ define(
|
|||||||
sum += counter[j];
|
sum += counter[j];
|
||||||
}
|
}
|
||||||
normalized = self._normalize(counter);
|
normalized = self._normalize(counter);
|
||||||
for ( code = self.START_CODE_A; code <= self.START_CODE_C; code++) {
|
if (normalized) {
|
||||||
|
for (code = self.START_CODE_A; code <= self.START_CODE_C; code++) {
|
||||||
error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
|
error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
|
||||||
if (error < bestMatch.error) {
|
if (error < bestMatch.error) {
|
||||||
bestMatch.code = code;
|
bestMatch.code = code;
|
||||||
@@ -222,6 +225,7 @@ define(
|
|||||||
bestMatch.end = i;
|
bestMatch.end = i;
|
||||||
return bestMatch;
|
return bestMatch;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for ( j = 0; j < 4; j++) {
|
for ( j = 0; j < 4; j++) {
|
||||||
counter[j] = counter[j + 2];
|
counter[j] = counter[j + 2];
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ define(
|
|||||||
decodedCodes.push(code);
|
decodedCodes.push(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
code = self._findPattern(self.MIDDLE_PATTERN, code.end, true);
|
code = self._findPattern(self.MIDDLE_PATTERN, code.end, true, false);
|
||||||
if (code === null) {
|
if (code === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-3
@@ -42,8 +42,8 @@ define(
|
|||||||
[2, 1, 1, 3]
|
[2, 1, 1, 3]
|
||||||
]},
|
]},
|
||||||
CODE_FREQUENCY : {value: [0, 11, 13, 14, 19, 25, 28, 21, 22, 26]},
|
CODE_FREQUENCY : {value: [0, 11, 13, 14, 19, 25, 28, 21, 22, 26]},
|
||||||
SINGLE_CODE_ERROR: {value: 0.7},
|
SINGLE_CODE_ERROR: {value: 0.67},
|
||||||
AVG_CODE_ERROR: {value: 0.3},
|
AVG_CODE_ERROR: {value: 0.27},
|
||||||
FORMAT: {value: "ean_13", writeable: false}
|
FORMAT: {value: "ean_13", writeable: false}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -77,7 +77,8 @@ define(
|
|||||||
} else {
|
} else {
|
||||||
if (counterPos === counter.length - 1) {
|
if (counterPos === counter.length - 1) {
|
||||||
normalized = self._normalize(counter);
|
normalized = self._normalize(counter);
|
||||||
for ( code = 0; code < coderange; code++) {
|
if (normalized) {
|
||||||
|
for (code = 0; code < coderange; code++) {
|
||||||
error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
|
error = self._matchPattern(normalized, self.CODE_PATTERN[code]);
|
||||||
if (error < bestMatch.error) {
|
if (error < bestMatch.error) {
|
||||||
bestMatch.code = code;
|
bestMatch.code = code;
|
||||||
@@ -89,6 +90,7 @@ define(
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return bestMatch;
|
return bestMatch;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
counterPos++;
|
counterPos++;
|
||||||
}
|
}
|
||||||
@@ -145,6 +147,7 @@ define(
|
|||||||
sum += counter[j];
|
sum += counter[j];
|
||||||
}
|
}
|
||||||
normalized = self._normalize(counter);
|
normalized = self._normalize(counter);
|
||||||
|
if (normalized) {
|
||||||
error = self._matchPattern(normalized, pattern);
|
error = self._matchPattern(normalized, pattern);
|
||||||
|
|
||||||
if (error < epsilon) {
|
if (error < epsilon) {
|
||||||
@@ -153,6 +156,7 @@ define(
|
|||||||
bestMatch.end = i;
|
bestMatch.end = i;
|
||||||
return bestMatch;
|
return bestMatch;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (tryHarder) {
|
if (tryHarder) {
|
||||||
for ( j = 0; j < counter.length - 2; j++) {
|
for ( j = 0; j < counter.length - 2; j++) {
|
||||||
counter[j] = counter[j + 2];
|
counter[j] = counter[j + 2];
|
||||||
|
|||||||
+5
-4
@@ -36,13 +36,13 @@ define(
|
|||||||
if (code.code >= self.CODE_G_START) {
|
if (code.code >= self.CODE_G_START) {
|
||||||
code.code = code.code - self.CODE_G_START;
|
code.code = code.code - self.CODE_G_START;
|
||||||
codeFrequency |= 1 << (5 - i);
|
codeFrequency |= 1 << (5 - i);
|
||||||
} else {
|
|
||||||
codeFrequency |= 0 << (5 - i);
|
|
||||||
}
|
}
|
||||||
result.push(code.code);
|
result.push(code.code);
|
||||||
decodedCodes.push(code);
|
decodedCodes.push(code);
|
||||||
}
|
}
|
||||||
self._determineParity(codeFrequency, result);
|
if (!self._determineParity(codeFrequency, result)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
};
|
};
|
||||||
@@ -57,10 +57,11 @@ define(
|
|||||||
if (codeFrequency === self.CODE_FREQUENCY[nrSystem][i]) {
|
if (codeFrequency === self.CODE_FREQUENCY[nrSystem][i]) {
|
||||||
result.unshift(nrSystem);
|
result.unshift(nrSystem);
|
||||||
result.push(i);
|
result.push(i);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
UPCEReader.prototype._convertToUPCA = function(result) {
|
UPCEReader.prototype._convertToUPCA = function(result) {
|
||||||
|
|||||||
Reference in New Issue
Block a user