Restructuring builds; Moved debug-config

pull/91/head
Christoph Oberhofer 10 years ago
parent 9cbfafe698
commit 16da30652c

232
dist/quagga.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -40,7 +40,10 @@
"scripts": {
"test": "grunt test",
"integrationtest": "grunt integrationtest",
"build:dev": "webpack && webpack --config webpack.config.min.js && grunt uglyasm && webpack --config webpack.node.config.js",
"build:dev": "cross-env BUILD_ENV=development webpack",
"build:prod": "cross-env BUILD_ENV=production webpack --config webpack.config.min.js && grunt uglyasm",
"build:node": "cross-env BUILD_ENV=node webpack --config webpack.node.config.js",
"build": "npm run build:dev && npm run build:prod && npm run build:node",
"watch": "cross-env BUILD_ENV=development webpack --watch",
"lint": "eslint src"
},

@ -158,7 +158,9 @@ export default {
ImageDebug.drawPath(line, {x: 'x', y: 'y'}, _canvas.ctx.overlay, {color: 'red', lineWidth: 3});
Bresenham.debug.printFrequency(barcodeLine.line, _canvas.dom.frequency);
}
Bresenham.toBinaryLine(barcodeLine);
if (ENV.development && config.debug.showPattern) {
Bresenham.debug.printPattern(barcodeLine.line, _canvas.dom.pattern);
}
@ -251,7 +253,7 @@ export default {
return null;
}
if (result && config.drawScanline && ctx) {
if (ENV.development && result && config.debug.drawScanline && ctx) {
ImageDebug.drawPath(line, {x: 'x', y: 'y'}, ctx, {color: 'red', lineWidth: 3});
}

@ -5,7 +5,7 @@ import ImageDebug from '../common/image_debug';
import Rasterizer from './rasterizer';
import Tracer from './tracer';
import skeletonizer from './skeletonizer';
import glMatrix from 'gl-matrix';
import {vec2, mat2} from 'gl-matrix';
var _config,
_currentImageWrapper,
@ -27,9 +27,7 @@ var _config,
},
_numPatches = {x: 0, y: 0},
_inputImageWrapper,
_skeletonizer,
vec2 = glMatrix.vec2,
mat2 = glMatrix.mat2;
_skeletonizer;
function initBuffers() {
var skeletonImageData;
@ -76,7 +74,7 @@ function initCanvas() {
}
_canvasContainer.dom.binary = document.createElement("canvas");
_canvasContainer.dom.binary.className = "binaryBuffer";
if (_config.showCanvas === true) {
if (ENV.development && _config.debug.showCanvas === true) {
document.querySelector("#debug").appendChild(_canvasContainer.dom.binary);
}
_canvasContainer.ctx.binary = _canvasContainer.dom.binary.getContext("2d");
@ -107,7 +105,7 @@ function boxFromPatches(patches) {
for ( i = 0; i < patches.length; i++) {
patch = patches[i];
overAvg += patch.rad;
if (_config.showPatches) {
if (ENV.development && _config.debug.showPatches) {
ImageDebug.drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary, {color: "red"});
}
}
@ -128,7 +126,7 @@ function boxFromPatches(patches) {
vec2.transformMat2(patch.box[j], patch.box[j], transMat);
}
if (_config.boxFromPatches.showTransformed) {
if (ENV.development && _config.debug.boxFromPatches.showTransformed) {
ImageDebug.drawPath(patch.box, {x: 0, y: 1}, _canvasContainer.ctx.binary, {color: '#99ff00', lineWidth: 2});
}
}
@ -154,7 +152,7 @@ function boxFromPatches(patches) {
box = [[minx, miny], [maxx, miny], [maxx, maxy], [minx, maxy]];
if (_config.boxFromPatches.showTransformedBox) {
if (ENV.development && _config.debug.boxFromPatches.showTransformedBox) {
ImageDebug.drawPath(box, {x: 0, y: 1}, _canvasContainer.ctx.binary, {color: '#ff0000', lineWidth: 2});
}
@ -165,7 +163,7 @@ function boxFromPatches(patches) {
vec2.transformMat2(box[j], box[j], transMat);
}
if (_config.boxFromPatches.showBB) {
if (ENV.development && _config.development.boxFromPatches.showBB) {
ImageDebug.drawPath(box, {x: 0, y: 1}, _canvasContainer.ctx.binary, {color: '#ff0000', lineWidth: 2});
}
@ -215,7 +213,7 @@ function findPatches() {
rasterizer = Rasterizer.create(_skelImageWrapper, _labelImageWrapper);
rasterResult = rasterizer.rasterize(0);
if (_config.showLabels) {
if (ENV.development && _config.debug.showLabels) {
_labelImageWrapper.overlay(_canvasContainer.dom.binary, Math.floor(360 / rasterResult.count),
{x: x, y: y});
}
@ -228,7 +226,7 @@ function findPatches() {
}
}
if (_config.showFoundPatches) {
if (ENV.development && _config.debug.showFoundPatches) {
for ( i = 0; i < patchesFound.length; i++) {
patch = patchesFound[i];
ImageDebug.drawRect(patch.pos, _subImageWrapper.size, _canvasContainer.ctx.binary,
@ -307,7 +305,7 @@ function findBoxes(topLabels, maxLabel) {
boxes.push(box);
// draw patch-labels if requested
if (_config.showRemainingPatchLabels) {
if (ENV.development && _config.debug.showRemainingPatchLabels) {
for ( j = 0; j < patches.length; j++) {
patch = patches[j];
hsv[0] = (topLabels[i].label / (maxLabel + 1)) * 360;
@ -345,7 +343,7 @@ function skeletonize(x, y) {
_skeletonizer.skeletonize();
// Show skeleton if requested
if (_config.showSkeleton) {
if (ENV.development && _config.debug.showSkeleton) {
_skelImageWrapper.overlay(_canvasContainer.dom.binary, 360, CVUtils.imageRef(x, y));
}
}
@ -493,7 +491,7 @@ function rasterizeAngularSimilarity(patchesFound) {
}
// draw patch-labels if requested
if (_config.showPatchLabels) {
if (ENV.development && _config.debug.showPatchLabels) {
for ( j = 0; j < _patchLabelGrid.data.length; j++) {
if (_patchLabelGrid.data[j] > 0 && _patchLabelGrid.data[j] <= label) {
patch = _imageToPatchGrid.data[j];

@ -1,4 +1,4 @@
import TypeDefs from './typedefs'; // eslint-disable-line no-unused-vars
import TypeDefs from './common/typedefs'; // eslint-disable-line no-unused-vars
import ImageWrapper from './common/image_wrapper';
import BarcodeLocator from './locator/barcode_locator';
import BarcodeDecoder from './decoder/barcode_decoder';
@ -489,6 +489,7 @@ export default {
size: 800,
src: config.src
},
numOfWorkers: ENV.development ? 0 : 1,
locator: {
halfSample: false
}

@ -17,8 +17,8 @@ module.exports = {
resolve: {
extensions: ['', '.js', '.jsx'],
alias: {
'input_stream$': path.resolve(__dirname, 'src/input_stream'),
'frame_grabber$': path.resolve(__dirname, 'src/frame_grabber')
'input_stream$': path.resolve(__dirname, 'src/input/input_stream'),
'frame_grabber$': path.resolve(__dirname, 'src/input/frame_grabber')
}
},
output: {

Loading…
Cancel
Save