mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-12 21:21:42 +08:00
Potential fix for #41
This commit is contained in:
@@ -82,7 +82,13 @@ define(
|
||||
} while(decodedChar !== '*');
|
||||
result.pop();
|
||||
|
||||
if (!result.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(!self._verifyTrailingWhitespace(lastStart, nextStart, counters)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
code : result.join(""),
|
||||
@@ -93,6 +99,17 @@ define(
|
||||
};
|
||||
};
|
||||
|
||||
Code39Reader.prototype._verifyTrailingWhitespace = function(lastStart, nextStart, counters) {
|
||||
var trailingWhitespaceEnd,
|
||||
patternSize = ArrayHelper.sum(counters);
|
||||
|
||||
trailingWhitespaceEnd = nextStart - lastStart - patternSize;
|
||||
if ((trailingWhitespaceEnd * 3) >= patternSize) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
Code39Reader.prototype._patternToChar = function(pattern) {
|
||||
var i,
|
||||
self = this;
|
||||
|
||||
@@ -24,12 +24,12 @@ define(["cv_utils"], function(CVUtils) {
|
||||
_canvas.height = _canvasSize.y;
|
||||
_ctx = _canvas.getContext("2d");
|
||||
_data = new Uint8Array(_size.x * _size.y);
|
||||
console.log("FrameGrabber", {
|
||||
console.log("FrameGrabber", JSON.stringify({
|
||||
size: _size,
|
||||
topRight: topRight,
|
||||
videoSize: _video_size,
|
||||
canvasSize: _canvasSize
|
||||
});
|
||||
}));
|
||||
|
||||
/**
|
||||
* Uses the given array as frame-buffer
|
||||
|
||||
Reference in New Issue
Block a user