Compare commits

...

1 Commits

Author SHA1 Message Date
rexagod 856880cb26 redo 2019-08-10 14:39:01 +05:30
4 changed files with 89 additions and 0 deletions
+1
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'),
+69
View File
@@ -0,0 +1,69 @@
/*
* 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 res = require('matcher-core');
async function run() {
const r = await res;
return r;
}
run().then(function(r) {
points = r.points;
}).catch(function(e) {
console.error(e);
});
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;
+4
View File
@@ -0,0 +1,4 @@
module.exports = [
require('./Module'),
require('./info.json')
];
+15
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": ""
}
}
}