Added DecodeQr Module, Test

This commit is contained in:
Chinmay Pandhare
2017-07-23 12:50:22 +05:30
parent 557a1166b3
commit 78beae48d9
7 changed files with 2908 additions and 106 deletions

View File

@@ -0,0 +1,29 @@
/*
* Decodes QR from a given image.
*/
module.exports = function DoNothing(options) {
options = options || {};
options.title = "Decode QR Code";
var output;
var jsQR = require('jsqr');
var getPixels = require('get-pixels');
function draw(input,callback) {
var this_ = this;
getPixels(input.src,function(err,pixels){
if(err) throw err;
var w = pixels.shape[0];
var h = pixels.shape[1];
var decoded = jsQR.decodeQRFromImage(pixels.data,w,h);
this_.output = input;
this_.output.data = decoded;
callback();
});
}
return {
options: options,
draw: draw,
output: output
}
}