Compare commits

...

3 Commits

Author SHA1 Message Date
Pranshu Srivastava
e8288bab61 Merge branch 'main' into mcore-integration 2019-08-23 00:57:58 +05:30
rexagod
10b2f16768 refactor 2019-08-13 02:02:07 +05:30
rexagod
856880cb26 redo 2019-08-10 14:39:01 +05:30
5 changed files with 84 additions and 0 deletions

View File

@@ -59,6 +59,7 @@
"jsdom": "^15.0.0",
"jsqr": "^1.1.1",
"lodash": "^4.17.11",
"matcher-core": "git@github.com:publiclab/matcher-core.git#matcher-node",
"ndarray": "^1.0.18",
"opencv.js": "^1.2.1",
"ora": "^3.0.0",

View File

@@ -31,6 +31,7 @@ module.exports = {
'import-image': require('./modules/ImportImage'),
'minify-image': require('./modules/MinifyImage'),
'invert': require('image-sequencer-invert'),
'matcher': require('./modules/Matcher'),
'ndvi': require('./modules/Ndvi'),
'ndvi-colormap': require('./modules/NdviColormap'),
'noise-reduction': require('./modules/NoiseReduction'),

View File

@@ -0,0 +1,63 @@
/*
* Match the images
*/
function Match(options, UI) {
var output, points;
var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
global.XY = [
options.imageX || defaults.imageX,
options.imageY || defaults.imageY
];
const core = require('matcher-core');
core(function(err, out, code){
points = JSON.parse(out.trim());
});
function draw(input, callback, progressObj) {
progressObj.stop(true);
progressObj.overrideFlag = true;
var step = this;
function changePixel(r, g, b, a, x, y) {
for(var i = 0; i < 500; i++){
if(Math.abs(points[i].x - x) <= 10 && Math.abs(points[i].y - y) <= 10){
return [0, 255, 0];
}
}
return [r, g, b, a];
}
function output(image, datauri, mimetype) {
step.output = { src: datauri, format: mimetype };
}
return input.pixelManipulation({
output: output,
changePixel: changePixel,
format: input.format,
image: options.image,
inBrowser: options.inBrowser,
callback: callback,
useWasm:options.useWasm
});
}
return {
options: options,
draw: draw,
output: output,
UI: UI
};
}
module.exports = Match;

View File

@@ -0,0 +1,4 @@
module.exports = [
require('./Module'),
require('./info.json')
];

View File

@@ -0,0 +1,15 @@
{
"name": "matcher-core",
"description": "Pattern-mining module for detecting key-points in images",
"url": "https://github.com/publiclab/matcher-core.git",
"inputs": {
"imageX": {
"type": "text",
"default": ""
},
"imageY": {
"type": "text",
"default": ""
}
}
}