mirror of
https://github.com/publiclab/image-sequencer.git
synced 2026-06-16 04:33:26 +02:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 856880cb26 |
@@ -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'),
|
||||
|
||||
@@ -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;
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = [
|
||||
require('./Module'),
|
||||
require('./info.json')
|
||||
];
|
||||
@@ -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": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user