mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-12 21:21:42 +08:00
Updated to 0.6.13
This commit is contained in:
+24
-13
@@ -802,7 +802,8 @@ define(
|
||||
} else {
|
||||
if (counterPos === counter.length - 1) {
|
||||
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]);
|
||||
if (error < bestMatch.error) {
|
||||
bestMatch.code = code;
|
||||
@@ -811,6 +812,7 @@ define(
|
||||
}
|
||||
bestMatch.end = i;
|
||||
return bestMatch;
|
||||
}
|
||||
} else {
|
||||
counterPos++;
|
||||
}
|
||||
@@ -850,7 +852,8 @@ define(
|
||||
sum += counter[j];
|
||||
}
|
||||
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]);
|
||||
if (error < bestMatch.error) {
|
||||
bestMatch.code = code;
|
||||
@@ -862,6 +865,7 @@ define(
|
||||
bestMatch.end = i;
|
||||
return bestMatch;
|
||||
}
|
||||
}
|
||||
|
||||
for ( j = 0; j < 4; j++) {
|
||||
counter[j] = counter[j + 2];
|
||||
@@ -1101,8 +1105,8 @@ define(
|
||||
[2, 1, 1, 3]
|
||||
]},
|
||||
CODE_FREQUENCY : {value: [0, 11, 13, 14, 19, 25, 28, 21, 22, 26]},
|
||||
SINGLE_CODE_ERROR: {value: 0.7},
|
||||
AVG_CODE_ERROR: {value: 0.3},
|
||||
SINGLE_CODE_ERROR: {value: 0.67},
|
||||
AVG_CODE_ERROR: {value: 0.27},
|
||||
FORMAT: {value: "ean_13", writeable: false}
|
||||
};
|
||||
|
||||
@@ -1136,7 +1140,8 @@ define(
|
||||
} else {
|
||||
if (counterPos === counter.length - 1) {
|
||||
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]);
|
||||
if (error < bestMatch.error) {
|
||||
bestMatch.code = code;
|
||||
@@ -1148,6 +1153,7 @@ define(
|
||||
return null;
|
||||
}
|
||||
return bestMatch;
|
||||
}
|
||||
} else {
|
||||
counterPos++;
|
||||
}
|
||||
@@ -1204,6 +1210,7 @@ define(
|
||||
sum += counter[j];
|
||||
}
|
||||
normalized = self._normalize(counter);
|
||||
if (normalized) {
|
||||
error = self._matchPattern(normalized, pattern);
|
||||
|
||||
if (error < epsilon) {
|
||||
@@ -1212,6 +1219,7 @@ define(
|
||||
bestMatch.end = i;
|
||||
return bestMatch;
|
||||
}
|
||||
}
|
||||
if (tryHarder) {
|
||||
for ( j = 0; j < counter.length - 2; j++) {
|
||||
counter[j] = counter[j + 2];
|
||||
@@ -6714,6 +6722,7 @@ define('bresenham',["cv_utils", "image_wrapper"], function(CVUtils, ImageWrapper
|
||||
max = result.max,
|
||||
line = result.line,
|
||||
slope,
|
||||
slope2,
|
||||
center = min + (max - min) / 2,
|
||||
extrema = [],
|
||||
currentDir,
|
||||
@@ -6729,11 +6738,12 @@ define('bresenham',["cv_utils", "image_wrapper"], function(CVUtils, ImageWrapper
|
||||
pos : 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]);
|
||||
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;
|
||||
} 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;
|
||||
} else {
|
||||
dir = currentDir;
|
||||
@@ -7474,7 +7484,7 @@ define(
|
||||
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) {
|
||||
return null;
|
||||
}
|
||||
@@ -7533,13 +7543,13 @@ define(
|
||||
if (code.code >= self.CODE_G_START) {
|
||||
code.code = code.code - self.CODE_G_START;
|
||||
codeFrequency |= 1 << (5 - i);
|
||||
} else {
|
||||
codeFrequency |= 0 << (5 - i);
|
||||
}
|
||||
result.push(code.code);
|
||||
decodedCodes.push(code);
|
||||
}
|
||||
self._determineParity(codeFrequency, result);
|
||||
if (!self._determineParity(codeFrequency, result)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return code;
|
||||
};
|
||||
@@ -7554,10 +7564,11 @@ define(
|
||||
if (codeFrequency === self.CODE_FREQUENCY[nrSystem][i]) {
|
||||
result.unshift(nrSystem);
|
||||
result.push(i);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
UPCEReader.prototype._convertToUPCA = function(result) {
|
||||
|
||||
Vendored
+4
-4
File diff suppressed because one or more lines are too long
@@ -7,7 +7,7 @@ showInMenu: true
|
||||
quaggaJS
|
||||
========
|
||||
|
||||
- [Changelog](#changelog) (2015-07-06)
|
||||
- [Changelog](#changelog) (2015-07-08)
|
||||
|
||||
## What is QuaggaJS?
|
||||
|
||||
@@ -370,6 +370,13 @@ on the ``singleChannel`` flag in the configuration when using ``decodeSingle``.
|
||||
|
||||
## <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
|
||||
- Improvements
|
||||
- Added `err` parameter to [Quagga.init()](#quaggainit) callback
|
||||
|
||||
Reference in New Issue
Block a user