mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-08 17:30:01 +01:00
Compare commits
3 Commits
test-jobs
...
mcore-inte
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8288bab61 | ||
|
|
10b2f16768 | ||
|
|
856880cb26 |
@@ -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",
|
||||
|
||||
@@ -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'),
|
||||
|
||||
63
src/modules/Matcher/Module.js
Normal file
63
src/modules/Matcher/Module.js
Normal 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;
|
||||
4
src/modules/Matcher/index.js
Normal file
4
src/modules/Matcher/index.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = [
|
||||
require('./Module'),
|
||||
require('./info.json')
|
||||
];
|
||||
15
src/modules/Matcher/info.json
Normal file
15
src/modules/Matcher/info.json
Normal 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": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user