async bug

This commit is contained in:
rexagod
2019-08-25 19:38:39 +05:30
parent 1b3e95fdd9
commit 7bed44e4c2
10 changed files with 81 additions and 2 deletions

View File

@@ -1 +1,2 @@
dist/*
dist/*
examples/orb.core.min.js

BIN
examples/images/big.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

BIN
examples/images/small.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

View File

@@ -28,6 +28,10 @@
<script src="../dist/image-sequencer.js" charset="utf-8"></script>
<script src="../dist/image-sequencer-ui.js" charset="utf-8"></script>
<script src="../node_modules/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.js"></script>
<!-- for matcher module -->
<script src="orb.core.min.js"></script>
<!-- for crop module: -->
<script src="../node_modules/imgareaselect/jquery.imgareaselect.dev.js"></script>
<script src="../node_modules/gifshot/dist/gifshot.min.js" type="text/javascript"></script>

1
examples/orb.core.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -29,6 +29,7 @@ module.exports = {
'gradient': require('./modules/Gradient'),
'grid-overlay': require('./modules/GridOverlay'),
'import-image': require('./modules/ImportImage'),
'matcher': require('./modules/Matcher'),
'minify-image': require('./modules/MinifyImage'),
'invert': require('image-sequencer-invert'),
'ndvi': require('./modules/Ndvi'),

View File

@@ -0,0 +1,54 @@
function Match(options, UI) {
var output;
new Matcher(
'examples/images/big.jpg',
'examples/images/small.jpg',
async function(q) {
var res = await q;
window.r = res;
console.log('Matcher loaded.');
}
);
var points = window.r.points;
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 < points.length; i++) {
if (Math.abs(points[i].x - x) <= 3 && Math.abs(points[i].y - y) <= 3) {
return [0, 255, 0, a];
}
}
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",
"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": ""
}
}
}

View File

@@ -73,4 +73,3 @@ function LoadImage(ref, name, src, main_callback) {
}
module.exports = LoadImage;