mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-13 11:50:02 +01:00
Merge Demo
This commit is contained in:
@@ -97,6 +97,35 @@ input = {
|
|||||||
|
|
||||||
For display in the web-based UI, each module may also have a title `options.title`.
|
For display in the web-based UI, each module may also have a title `options.title`.
|
||||||
|
|
||||||
|
## Info file
|
||||||
|
|
||||||
|
All module folders must have an `info.json` file which looks like the following:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "Name of Module to be displayed",
|
||||||
|
"inputs": {
|
||||||
|
"var1": {
|
||||||
|
"type": "text",
|
||||||
|
"default": "default value"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Types may be one of "text", "integer", "float", "select".
|
||||||
|
Integer and Float types should also specify minimum and maximum values like this:
|
||||||
|
|
||||||
|
```json
|
||||||
|
"var1": {
|
||||||
|
"type": "integer",
|
||||||
|
"min": 0,
|
||||||
|
"max": 4,
|
||||||
|
"default": 1
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Similarly, "Select" type inputs should have a `values` array.
|
||||||
|
|
||||||
### Module example
|
### Module example
|
||||||
|
|
||||||
See existing module `green-channel` for an example: https://github.com/publiclab/image-sequencer/tree/master/src/modules/GreenChannel/Module.js
|
See existing module `green-channel` for an example: https://github.com/publiclab/image-sequencer/tree/master/src/modules/GreenChannel/Module.js
|
||||||
|
|||||||
@@ -420,3 +420,6 @@ Note: `identity.imageName` is the "name" of that particular image. This name can
|
|||||||
be specified while loading the image via `sequencer.loadImage("name","SRC")`. If
|
be specified while loading the image via `sequencer.loadImage("name","SRC")`. If
|
||||||
not specified, the name of a loaded image defaults to a name like "image1",
|
not specified, the name of a loaded image defaults to a name like "image1",
|
||||||
"image2", et cetra.
|
"image2", et cetra.
|
||||||
|
|
||||||
|
Details of all modules can be sought using `sequencer.modulesInfo()`.
|
||||||
|
This method returns an object which defines the name and inputs of the modules. If a module name (hyphenated) is passed in the method, then only the details of that module are returned.
|
||||||
|
|||||||
267
dist/image-sequencer.js
vendored
267
dist/image-sequencer.js
vendored
@@ -27866,10 +27866,11 @@ function AddStep(ref, image, name, o) {
|
|||||||
ID: o.number,
|
ID: o.number,
|
||||||
imageName: o.image,
|
imageName: o.image,
|
||||||
inBrowser: ref.options.inBrowser,
|
inBrowser: ref.options.inBrowser,
|
||||||
ui: ref.options.ui
|
ui: ref.options.ui,
|
||||||
|
options: o
|
||||||
};
|
};
|
||||||
var UI = ref.events;
|
var UI = ref.events;
|
||||||
var module = ref.modules[name](o,UI);
|
var module = ref.modules[name][0](o,UI);
|
||||||
ref.images[image].steps.push(module);
|
ref.images[image].steps.push(module);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -28282,6 +28283,17 @@ ImageSequencer = function ImageSequencer(options) {
|
|||||||
return require('./ExportBin')(this);
|
return require('./ExportBin')(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function modulesInfo(name) {
|
||||||
|
window.data = require('./modules/Crop/info.json');
|
||||||
|
var modulesdata = {}
|
||||||
|
if(arguments.length==0)
|
||||||
|
for (var modulename in modules) {
|
||||||
|
modulesdata[modulename] = modules[modulename][1];
|
||||||
|
}
|
||||||
|
else modulesdata = modules[name][1];
|
||||||
|
return modulesdata;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
//literals and objects
|
//literals and objects
|
||||||
name: "ImageSequencer",
|
name: "ImageSequencer",
|
||||||
@@ -28301,6 +28313,7 @@ ImageSequencer = function ImageSequencer(options) {
|
|||||||
run: run,
|
run: run,
|
||||||
setUI: setUI,
|
setUI: setUI,
|
||||||
exportBin: exportBin,
|
exportBin: exportBin,
|
||||||
|
modulesInfo: modulesInfo,
|
||||||
|
|
||||||
//other functions
|
//other functions
|
||||||
log: log,
|
log: log,
|
||||||
@@ -28311,7 +28324,7 @@ ImageSequencer = function ImageSequencer(options) {
|
|||||||
}
|
}
|
||||||
module.exports = ImageSequencer;
|
module.exports = ImageSequencer;
|
||||||
|
|
||||||
},{"./AddStep":120,"./ExportBin":121,"./FormatInput":122,"./InsertStep":124,"./LoadImage":125,"./Modules":126,"./ReplaceImage":127,"./Run":128,"./UserInterface":129,"fs":6,"jquery":142}],124:[function(require,module,exports){
|
},{"./AddStep":120,"./ExportBin":121,"./FormatInput":122,"./InsertStep":124,"./LoadImage":125,"./Modules":126,"./ReplaceImage":127,"./Run":128,"./UserInterface":129,"./modules/Crop/info.json":132,"fs":6,"jquery":151}],124:[function(require,module,exports){
|
||||||
function InsertStep(ref, image, index, name, o) {
|
function InsertStep(ref, image, index, name, o) {
|
||||||
|
|
||||||
function insertStep(image, index, name, o_) {
|
function insertStep(image, index, name, o_) {
|
||||||
@@ -28329,10 +28342,11 @@ function InsertStep(ref, image, index, name, o) {
|
|||||||
ID: o.number,
|
ID: o.number,
|
||||||
imageName: o.image,
|
imageName: o.image,
|
||||||
inBrowser: ref.options.inBrowser,
|
inBrowser: ref.options.inBrowser,
|
||||||
ui: ref.options.ui
|
ui: ref.options.ui,
|
||||||
|
options: o
|
||||||
};
|
};
|
||||||
var UI = ref.events;
|
var UI = ref.events;
|
||||||
var module = ref.modules[name](o,UI);
|
var module = ref.modules[name][0](o,UI);
|
||||||
ref.images[image].steps.splice(index,0,module);
|
ref.images[image].steps.splice(index,0,module);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -28448,21 +28462,39 @@ module.exports = LoadImage;
|
|||||||
|
|
||||||
},{"urify":115}],126:[function(require,module,exports){
|
},{"urify":115}],126:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
* Core modules
|
* Core modules and their info files
|
||||||
*/
|
*/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'do-nothing': require('./modules/DoNothing/Module'),
|
'do-nothing': [
|
||||||
'green-channel': require('./modules/GreenChannel/Module'),
|
require('./modules/DoNothing/Module'),require('./modules/DoNothing/info')
|
||||||
'ndvi-red': require('./modules/NdviRed/Module'),
|
],
|
||||||
'do-nothing-pix': require('./modules/DoNothingPix/Module.js'),
|
'green-channel': [
|
||||||
'invert': require('./modules/Invert/Module'),
|
require('./modules/GreenChannel/Module'),require('./modules/GreenChannel/info')
|
||||||
'crop': require('./modules/Crop/Module'),
|
],
|
||||||
'segmented-colormap': require('./modules/SegmentedColormap/Module'),
|
'ndvi-red': [
|
||||||
'decode-qr': require('./modules/DecodeQr/Module'),
|
require('./modules/NdviRed/Module'),require('./modules/NdviRed/info')
|
||||||
'fisheye-gl': require('./modules/FisheyeGl/Module')
|
],
|
||||||
|
'do-nothing-pix': [
|
||||||
|
require('./modules/DoNothingPix/Module'),require('./modules/DoNothingPix/info')
|
||||||
|
],
|
||||||
|
'invert': [
|
||||||
|
require('./modules/Invert/Module'),require('./modules/Invert/info')
|
||||||
|
],
|
||||||
|
'crop': [
|
||||||
|
require('./modules/Crop/Module'),require('./modules/Crop/info')
|
||||||
|
],
|
||||||
|
'segmented-colormap': [
|
||||||
|
require('./modules/SegmentedColormap/Module'),require('./modules/SegmentedColormap/info')
|
||||||
|
],
|
||||||
|
'decode-qr': [
|
||||||
|
require('./modules/DecodeQr/Module'),require('./modules/DecodeQr/info')
|
||||||
|
],
|
||||||
|
'fisheye-gl': [
|
||||||
|
require('./modules/FisheyeGl/Module'),require('./modules/FisheyeGl/info')
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
},{"./modules/Crop/Module":131,"./modules/DecodeQr/Module":132,"./modules/DoNothing/Module":133,"./modules/DoNothingPix/Module.js":134,"./modules/FisheyeGl/Module":135,"./modules/GreenChannel/Module":136,"./modules/Invert/Module":137,"./modules/NdviRed/Module":138,"./modules/SegmentedColormap/Module":139}],127:[function(require,module,exports){
|
},{"./modules/Crop/Module":131,"./modules/Crop/info":132,"./modules/DecodeQr/Module":133,"./modules/DecodeQr/info":134,"./modules/DoNothing/Module":135,"./modules/DoNothing/info":136,"./modules/DoNothingPix/Module":137,"./modules/DoNothingPix/info":138,"./modules/FisheyeGl/Module":139,"./modules/FisheyeGl/info":140,"./modules/GreenChannel/Module":141,"./modules/GreenChannel/info":142,"./modules/Invert/Module":143,"./modules/Invert/info":144,"./modules/NdviRed/Module":145,"./modules/NdviRed/info":146,"./modules/SegmentedColormap/Module":147,"./modules/SegmentedColormap/info":149}],127:[function(require,module,exports){
|
||||||
function ReplaceImage(ref,selector,steps,options) {
|
function ReplaceImage(ref,selector,steps,options) {
|
||||||
if(!ref.options.inBrowser) return false; // This isn't for Node.js
|
if(!ref.options.inBrowser) return false; // This isn't for Node.js
|
||||||
var this_ = ref;
|
var this_ = ref;
|
||||||
@@ -28623,11 +28655,16 @@ module.exports = function Crop(input,options,callback) {
|
|||||||
var getPixels = require('get-pixels'),
|
var getPixels = require('get-pixels'),
|
||||||
savePixels = require('save-pixels');
|
savePixels = require('save-pixels');
|
||||||
|
|
||||||
|
options.x = parseInt(options.x) || 0;
|
||||||
|
options.y = parseInt(options.y) || 0;
|
||||||
|
|
||||||
getPixels(input.src,function(err,pixels){
|
getPixels(input.src,function(err,pixels){
|
||||||
var ox = options.x || 0;
|
options.w = parseInt(options.w) || Math.floor(0.5*pixels.shape[0]);
|
||||||
var oy = options.y || 0;
|
options.h = parseInt(options.h) || Math.floor(0.5*pixels.shape[1]);
|
||||||
var w = options.w || Math.floor(0.5*pixels.shape[0]);
|
var ox = options.x;
|
||||||
var h = options.h || Math.floor(0.5*pixels.shape[1]);
|
var oy = options.y;
|
||||||
|
var w = options.w;
|
||||||
|
var h = options.h;
|
||||||
var iw = pixels.shape[0]; //Width of Original Image
|
var iw = pixels.shape[0]; //Width of Original Image
|
||||||
var newarray = new Uint8Array(4*w*h);
|
var newarray = new Uint8Array(4*w*h);
|
||||||
for (var n = oy; n < oy + h; n++) {
|
for (var n = oy; n < oy + h; n++) {
|
||||||
@@ -28706,6 +28743,33 @@ module.exports = function Crop(input,options,callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
},{"./Crop":130}],132:[function(require,module,exports){
|
},{"./Crop":130}],132:[function(require,module,exports){
|
||||||
|
module.exports={
|
||||||
|
"name": "Crop",
|
||||||
|
"inputs": {
|
||||||
|
"x": {
|
||||||
|
"type": "integer",
|
||||||
|
"desc": "X-position (measured from left) from where cropping starts",
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"y": {
|
||||||
|
"type": "integer",
|
||||||
|
"desc": "Y-position (measured from top) from where cropping starts",
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"w": {
|
||||||
|
"type": "integer",
|
||||||
|
"desc": "Width of crop",
|
||||||
|
"default": "(50%)"
|
||||||
|
},
|
||||||
|
"h": {
|
||||||
|
"type": "integer",
|
||||||
|
"desc": "Height of crop",
|
||||||
|
"default": "(50%)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},{}],133:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
* Decodes QR from a given image.
|
* Decodes QR from a given image.
|
||||||
*/
|
*/
|
||||||
@@ -28743,7 +28807,14 @@ module.exports = function DoNothing(options,UI) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},{"get-pixels":32,"jsqr":50}],133:[function(require,module,exports){
|
},{"get-pixels":32,"jsqr":50}],134:[function(require,module,exports){
|
||||||
|
module.exports={
|
||||||
|
"name": "Decode QR",
|
||||||
|
"inputs": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},{}],135:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
* Demo Module. Does nothing. Adds a step where output is equal to input.
|
* Demo Module. Does nothing. Adds a step where output is equal to input.
|
||||||
*/
|
*/
|
||||||
@@ -28771,7 +28842,14 @@ module.exports = function DoNothing(options,UI) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},{}],134:[function(require,module,exports){
|
},{}],136:[function(require,module,exports){
|
||||||
|
module.exports={
|
||||||
|
"name": "Do Nothing",
|
||||||
|
"inputs": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},{}],137:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
* This module extracts pixels and saves them as it is.
|
* This module extracts pixels and saves them as it is.
|
||||||
*/
|
*/
|
||||||
@@ -28813,7 +28891,14 @@ module.exports = function DoNothingPix(options,UI) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},{"../_nomodule/PixelManipulation.js":141}],135:[function(require,module,exports){
|
},{"../_nomodule/PixelManipulation.js":150}],138:[function(require,module,exports){
|
||||||
|
module.exports={
|
||||||
|
"name": "extract pixels, do nothing, and replace",
|
||||||
|
"inputs": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},{}],139:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
* Creates Fisheye Effect
|
* Creates Fisheye Effect
|
||||||
*/
|
*/
|
||||||
@@ -28844,13 +28929,21 @@ module.exports = function DoNothing(options,UI) {
|
|||||||
selector: "#image-sequencer-canvas"
|
selector: "#image-sequencer-canvas"
|
||||||
});
|
});
|
||||||
|
|
||||||
distorter.lens.a = options.a || distorter.lens.a;
|
options.a = parseFloat(options.a) || distorter.lens.a;
|
||||||
distorter.lens.b = options.b || distorter.lens.b;
|
options.b = parseFloat(options.b) || distorter.lens.b;
|
||||||
distorter.lens.Fx = options.Fx || distorter.lens.Fx;
|
options.Fx = parseFloat(options.Fx) || distorter.lens.Fx;
|
||||||
distorter.lens.Fy = options.Fy || distorter.lens.Fy;
|
options.Fy = parseFloat(options.Fy) || distorter.lens.Fy;
|
||||||
distorter.lens.scale = options.scale || distorter.lens.scale;
|
options.scale = parseFloat(options.scale) || distorter.lens.scale;
|
||||||
distorter.fov.x = options.x || distorter.fov.x;
|
options.x = parseFloat(options.x) || distorter.fov.x;
|
||||||
distorter.fov.y = options.y || distorter.fov.y;
|
options.y = parseFloat(options.y) || distorter.fov.y;
|
||||||
|
|
||||||
|
distorter.lens.a = options.a;
|
||||||
|
distorter.lens.b = options.b;
|
||||||
|
distorter.lens.Fx = options.Fx;
|
||||||
|
distorter.lens.Fy = options.Fy;
|
||||||
|
distorter.lens.scale = options.scale;
|
||||||
|
distorter.fov.x = options.x;
|
||||||
|
distorter.fov.y = options.y;
|
||||||
|
|
||||||
distorter.setImage(input.src,function(){
|
distorter.setImage(input.src,function(){
|
||||||
step.output = {src: canvas.toDataURL(), format: input.format};
|
step.output = {src: canvas.toDataURL(), format: input.format};
|
||||||
@@ -28870,7 +28963,73 @@ module.exports = function DoNothing(options,UI) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},{"fisheyegl":24}],136:[function(require,module,exports){
|
},{"fisheyegl":24}],140:[function(require,module,exports){
|
||||||
|
module.exports={
|
||||||
|
"name": "Fisheye GL",
|
||||||
|
"inputs": {
|
||||||
|
"a": {
|
||||||
|
"type": "float",
|
||||||
|
"desc": "a parameter",
|
||||||
|
"default": 1,
|
||||||
|
"min": 1,
|
||||||
|
"max": 4
|
||||||
|
},
|
||||||
|
"b": {
|
||||||
|
"type": "float",
|
||||||
|
"desc": "b parameter",
|
||||||
|
"default": 1,
|
||||||
|
"min": 1,
|
||||||
|
"max": 4
|
||||||
|
},
|
||||||
|
"Fx": {
|
||||||
|
"type": "float",
|
||||||
|
"desc": "Fx parameter",
|
||||||
|
"default": 0,
|
||||||
|
"min": 0,
|
||||||
|
"max": 4
|
||||||
|
},
|
||||||
|
"Fy": {
|
||||||
|
"type": "float",
|
||||||
|
"desc": "Fy parameter",
|
||||||
|
"default": 0,
|
||||||
|
"min": 0,
|
||||||
|
"max": 4
|
||||||
|
},
|
||||||
|
"scale": {
|
||||||
|
"type": "float",
|
||||||
|
"desc": "Image Scaling",
|
||||||
|
"default": 1.5,
|
||||||
|
"min": 0,
|
||||||
|
"max": 20
|
||||||
|
},
|
||||||
|
"x": {
|
||||||
|
"type": "float",
|
||||||
|
"desc": "FOV x parameter",
|
||||||
|
"default": 1.5,
|
||||||
|
"min": 0,
|
||||||
|
"max": 20
|
||||||
|
},
|
||||||
|
"y": {
|
||||||
|
"type": "float",
|
||||||
|
"desc": "FOV y parameter",
|
||||||
|
"default": 1.5,
|
||||||
|
"min": 0,
|
||||||
|
"max": 20
|
||||||
|
},
|
||||||
|
"fragmentSrc": {
|
||||||
|
"type": "PATH",
|
||||||
|
"desc": "Patht to a WebGL fragment shader file",
|
||||||
|
"default": "(inbuilt)"
|
||||||
|
},
|
||||||
|
"vertexSrc": {
|
||||||
|
"type": "PATH",
|
||||||
|
"desc": "Patht to a WebGL vertex shader file",
|
||||||
|
"default": "(inbuilt)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},{}],141:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
* Display only the green channel
|
* Display only the green channel
|
||||||
*/
|
*/
|
||||||
@@ -28914,7 +29073,14 @@ module.exports = function GreenChannel(options,UI) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},{"../_nomodule/PixelManipulation.js":141}],137:[function(require,module,exports){
|
},{"../_nomodule/PixelManipulation.js":150}],142:[function(require,module,exports){
|
||||||
|
module.exports={
|
||||||
|
"name": "Green Channel",
|
||||||
|
"inputs": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},{}],143:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
* Display only the green channel
|
* Display only the green channel
|
||||||
*/
|
*/
|
||||||
@@ -28960,7 +29126,14 @@ module.exports = function GreenChannel(options,UI) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},{"../_nomodule/PixelManipulation.js":141}],138:[function(require,module,exports){
|
},{"../_nomodule/PixelManipulation.js":150}],144:[function(require,module,exports){
|
||||||
|
module.exports={
|
||||||
|
"name": "Invert",
|
||||||
|
"inputs": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},{}],145:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
* NDVI with red filter (blue channel is infrared)
|
* NDVI with red filter (blue channel is infrared)
|
||||||
*/
|
*/
|
||||||
@@ -29004,7 +29177,14 @@ module.exports = function NdviRed(options,UI) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},{"../_nomodule/PixelManipulation.js":141}],139:[function(require,module,exports){
|
},{"../_nomodule/PixelManipulation.js":150}],146:[function(require,module,exports){
|
||||||
|
module.exports={
|
||||||
|
"name": "NDVI Red",
|
||||||
|
"inputs": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},{}],147:[function(require,module,exports){
|
||||||
module.exports = function SegmentedColormap(options,UI) {
|
module.exports = function SegmentedColormap(options,UI) {
|
||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
@@ -29046,7 +29226,7 @@ module.exports = function SegmentedColormap(options,UI) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},{"../_nomodule/PixelManipulation.js":141,"./SegmentedColormap":140}],140:[function(require,module,exports){
|
},{"../_nomodule/PixelManipulation.js":150,"./SegmentedColormap":148}],148:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
* Accepts a normalized ndvi and returns the new color-mapped pixel
|
* Accepts a normalized ndvi and returns the new color-mapped pixel
|
||||||
*/
|
*/
|
||||||
@@ -29105,7 +29285,20 @@ var colormaps = {
|
|||||||
fastie: fastie_colormap
|
fastie: fastie_colormap
|
||||||
}
|
}
|
||||||
|
|
||||||
},{}],141:[function(require,module,exports){
|
},{}],149:[function(require,module,exports){
|
||||||
|
module.exports={
|
||||||
|
"name": "Segmented Colormap",
|
||||||
|
"inputs": {
|
||||||
|
"colormap": {
|
||||||
|
"type": "select",
|
||||||
|
"desc": "Name of the Colormap",
|
||||||
|
"default": "default",
|
||||||
|
"values": ["default","greyscale","stretched","fastie"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},{}],150:[function(require,module,exports){
|
||||||
(function (Buffer){
|
(function (Buffer){
|
||||||
/*
|
/*
|
||||||
* General purpose per-pixel manipulation
|
* General purpose per-pixel manipulation
|
||||||
@@ -29169,7 +29362,7 @@ module.exports = function PixelManipulation(image, options) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
}).call(this,require("buffer").Buffer)
|
}).call(this,require("buffer").Buffer)
|
||||||
},{"buffer":7,"get-pixels":32,"save-pixels":110}],142:[function(require,module,exports){
|
},{"buffer":7,"get-pixels":32,"save-pixels":110}],151:[function(require,module,exports){
|
||||||
/*!
|
/*!
|
||||||
* jQuery JavaScript Library v2.2.4
|
* jQuery JavaScript Library v2.2.4
|
||||||
* http://jquery.com/
|
* http://jquery.com/
|
||||||
|
|||||||
@@ -51,13 +51,6 @@
|
|||||||
Add Step :
|
Add Step :
|
||||||
<select style="font-family: sans-serif; height: 30px">
|
<select style="font-family: sans-serif; height: 30px">
|
||||||
<option value="none" disabled selected>Please Select</option>
|
<option value="none" disabled selected>Please Select</option>
|
||||||
<option value="crop">Crop</option>
|
|
||||||
<option value="decode-qr">Decode Qr</option>
|
|
||||||
<option value="fisheye-gl">Fisheye GL</option>
|
|
||||||
<option value="green-channel">Green Channel</option>
|
|
||||||
<option value="invert">Invert</option>
|
|
||||||
<option value="ndvi-red">NDVI Red</option>
|
|
||||||
<option value="segmented-colormap">Segmented Colormap</option>
|
|
||||||
</select>
|
</select>
|
||||||
<button type="button" name="add">Add Step</button>
|
<button type="button" name="add">Add Step</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -65,23 +58,7 @@
|
|||||||
<div class="c">
|
<div class="c">
|
||||||
Options:
|
Options:
|
||||||
</div>
|
</div>
|
||||||
<div class="c rh">
|
<div id="options" class="c rh">
|
||||||
<div class="r">
|
|
||||||
<div class="c">
|
|
||||||
key:
|
|
||||||
</div>
|
|
||||||
<div class="c">
|
|
||||||
<input type="text" name="" value="" placeholder="default"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="r">
|
|
||||||
<div class="c">
|
|
||||||
key:
|
|
||||||
</div>
|
|
||||||
<div class="c">
|
|
||||||
<input type="text" name="" value="" placeholder="default"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -90,10 +67,18 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
var sequencer = ImageSequencer();
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
|
|
||||||
|
var modulesInfo = sequencer.modulesInfo();
|
||||||
|
|
||||||
var sequencer = ImageSequencer();
|
for(var m in modulesInfo) {
|
||||||
|
if(m!="do-nothing" && m!="do-nothing-pix")
|
||||||
|
$('#addStep select').append(
|
||||||
|
'<option value="'+m+'">'+modulesInfo[m].name+'</option>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
var steps = document.querySelector('#steps');
|
var steps = document.querySelector('#steps');
|
||||||
var parser = new DOMParser();
|
var parser = new DOMParser();
|
||||||
@@ -111,8 +96,6 @@
|
|||||||
</div>\
|
</div>\
|
||||||
<div class="c rh details">\
|
<div class="c rh details">\
|
||||||
<div class="r"><h4>'+step.name+'</h4></div>\
|
<div class="r"><h4>'+step.name+'</h4></div>\
|
||||||
<div class="r nomargin">Width: x</div>\
|
|
||||||
<div class="r nomargin">Height: y</div>\
|
|
||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
';
|
';
|
||||||
@@ -124,6 +107,17 @@
|
|||||||
step.ui = step.ui.querySelector('div.r');
|
step.ui = step.ui.querySelector('div.r');
|
||||||
step.imgElement = step.ui.querySelector('img');
|
step.imgElement = step.ui.querySelector('img');
|
||||||
|
|
||||||
|
if(sequencer.modulesInfo().hasOwnProperty(step.name)) {
|
||||||
|
var inputs = sequencer.modulesInfo(step.name).inputs;
|
||||||
|
for (var i in inputs) {
|
||||||
|
var div = document.createElement('div');
|
||||||
|
div.className = "r nomargin";
|
||||||
|
div.setAttribute('name',i);
|
||||||
|
div.innerHTML = i + ": " + "<span></span>";
|
||||||
|
step.ui.querySelector('div.details').appendChild(div);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(step.name != "load-image")
|
if(step.name != "load-image")
|
||||||
step.ui.querySelector('div.details').appendChild(
|
step.ui.querySelector('div.details').appendChild(
|
||||||
parser.parseFromString(removebutton,'text/html')
|
parser.parseFromString(removebutton,'text/html')
|
||||||
@@ -134,7 +128,17 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
onComplete: function(step) {
|
onComplete: function(step) {
|
||||||
|
|
||||||
step.imgElement.src = step.output;
|
step.imgElement.src = step.output;
|
||||||
|
|
||||||
|
if(sequencer.modulesInfo().hasOwnProperty(step.name)) {
|
||||||
|
var inputs = sequencer.modulesInfo(step.name).inputs;
|
||||||
|
for (var i in inputs) {
|
||||||
|
step.ui.querySelector('div[name="'+i+'"] span')
|
||||||
|
.innerHTML = step.options[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onRemove: function(step) {
|
onRemove: function(step) {
|
||||||
@@ -147,9 +151,32 @@
|
|||||||
this.addSteps('crop').run();
|
this.addSteps('crop').run();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#addStep select').on('change', function(){
|
||||||
|
$('#options').html('');
|
||||||
|
var m = $('#addStep select').val();
|
||||||
|
for(var input in modulesInfo[m].inputs) {
|
||||||
|
$('#options').append(
|
||||||
|
'<div class="r">\
|
||||||
|
<div class="c">\
|
||||||
|
'+input+':\
|
||||||
|
</div>\
|
||||||
|
<div class="c">\
|
||||||
|
<input type="text" name="'+input+'" value="" placeholder="'+
|
||||||
|
modulesInfo[m].inputs[input].default+'"/>\
|
||||||
|
</div>\
|
||||||
|
</div>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$('#addStep button').on('click',function(){
|
$('#addStep button').on('click',function(){
|
||||||
|
var options = {};
|
||||||
|
var inputs = $('#options input');
|
||||||
|
$.each(inputs, function() {
|
||||||
|
options[this.name] = $(this).val();
|
||||||
|
});
|
||||||
if($('#addStep select').val()=="none") return;
|
if($('#addStep select').val()=="none") return;
|
||||||
sequencer.addSteps($('#addStep select').val()).run();
|
sequencer.addSteps($('#addStep select').val(),options).run();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('body').on('click','button.remove',function(){
|
$('body').on('click','button.remove',function(){
|
||||||
|
|||||||
@@ -14,10 +14,11 @@ function AddStep(ref, image, name, o) {
|
|||||||
ID: o.number,
|
ID: o.number,
|
||||||
imageName: o.image,
|
imageName: o.image,
|
||||||
inBrowser: ref.options.inBrowser,
|
inBrowser: ref.options.inBrowser,
|
||||||
ui: ref.options.ui
|
ui: ref.options.ui,
|
||||||
|
options: o
|
||||||
};
|
};
|
||||||
var UI = ref.events;
|
var UI = ref.events;
|
||||||
var module = ref.modules[name](o,UI);
|
var module = ref.modules[name][0](o,UI);
|
||||||
ref.images[image].steps.push(module);
|
ref.images[image].steps.push(module);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -180,6 +180,17 @@ ImageSequencer = function ImageSequencer(options) {
|
|||||||
return require('./ExportBin')(this);
|
return require('./ExportBin')(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function modulesInfo(name) {
|
||||||
|
window.data = require('./modules/Crop/info.json');
|
||||||
|
var modulesdata = {}
|
||||||
|
if(arguments.length==0)
|
||||||
|
for (var modulename in modules) {
|
||||||
|
modulesdata[modulename] = modules[modulename][1];
|
||||||
|
}
|
||||||
|
else modulesdata = modules[name][1];
|
||||||
|
return modulesdata;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
//literals and objects
|
//literals and objects
|
||||||
name: "ImageSequencer",
|
name: "ImageSequencer",
|
||||||
@@ -199,6 +210,7 @@ ImageSequencer = function ImageSequencer(options) {
|
|||||||
run: run,
|
run: run,
|
||||||
setUI: setUI,
|
setUI: setUI,
|
||||||
exportBin: exportBin,
|
exportBin: exportBin,
|
||||||
|
modulesInfo: modulesInfo,
|
||||||
|
|
||||||
//other functions
|
//other functions
|
||||||
log: log,
|
log: log,
|
||||||
|
|||||||
@@ -15,10 +15,11 @@ function InsertStep(ref, image, index, name, o) {
|
|||||||
ID: o.number,
|
ID: o.number,
|
||||||
imageName: o.image,
|
imageName: o.image,
|
||||||
inBrowser: ref.options.inBrowser,
|
inBrowser: ref.options.inBrowser,
|
||||||
ui: ref.options.ui
|
ui: ref.options.ui,
|
||||||
|
options: o
|
||||||
};
|
};
|
||||||
var UI = ref.events;
|
var UI = ref.events;
|
||||||
var module = ref.modules[name](o,UI);
|
var module = ref.modules[name][0](o,UI);
|
||||||
ref.images[image].steps.splice(index,0,module);
|
ref.images[image].steps.splice(index,0,module);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,14 +1,32 @@
|
|||||||
/*
|
/*
|
||||||
* Core modules
|
* Core modules and their info files
|
||||||
*/
|
*/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'do-nothing': require('./modules/DoNothing/Module'),
|
'do-nothing': [
|
||||||
'green-channel': require('./modules/GreenChannel/Module'),
|
require('./modules/DoNothing/Module'),require('./modules/DoNothing/info')
|
||||||
'ndvi-red': require('./modules/NdviRed/Module'),
|
],
|
||||||
'do-nothing-pix': require('./modules/DoNothingPix/Module.js'),
|
'green-channel': [
|
||||||
'invert': require('./modules/Invert/Module'),
|
require('./modules/GreenChannel/Module'),require('./modules/GreenChannel/info')
|
||||||
'crop': require('./modules/Crop/Module'),
|
],
|
||||||
'segmented-colormap': require('./modules/SegmentedColormap/Module'),
|
'ndvi-red': [
|
||||||
'decode-qr': require('./modules/DecodeQr/Module'),
|
require('./modules/NdviRed/Module'),require('./modules/NdviRed/info')
|
||||||
'fisheye-gl': require('./modules/FisheyeGl/Module')
|
],
|
||||||
|
'do-nothing-pix': [
|
||||||
|
require('./modules/DoNothingPix/Module'),require('./modules/DoNothingPix/info')
|
||||||
|
],
|
||||||
|
'invert': [
|
||||||
|
require('./modules/Invert/Module'),require('./modules/Invert/info')
|
||||||
|
],
|
||||||
|
'crop': [
|
||||||
|
require('./modules/Crop/Module'),require('./modules/Crop/info')
|
||||||
|
],
|
||||||
|
'segmented-colormap': [
|
||||||
|
require('./modules/SegmentedColormap/Module'),require('./modules/SegmentedColormap/info')
|
||||||
|
],
|
||||||
|
'decode-qr': [
|
||||||
|
require('./modules/DecodeQr/Module'),require('./modules/DecodeQr/info')
|
||||||
|
],
|
||||||
|
'fisheye-gl': [
|
||||||
|
require('./modules/FisheyeGl/Module'),require('./modules/FisheyeGl/info')
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,16 @@ module.exports = function Crop(input,options,callback) {
|
|||||||
var getPixels = require('get-pixels'),
|
var getPixels = require('get-pixels'),
|
||||||
savePixels = require('save-pixels');
|
savePixels = require('save-pixels');
|
||||||
|
|
||||||
|
options.x = parseInt(options.x) || 0;
|
||||||
|
options.y = parseInt(options.y) || 0;
|
||||||
|
|
||||||
getPixels(input.src,function(err,pixels){
|
getPixels(input.src,function(err,pixels){
|
||||||
var ox = options.x || 0;
|
options.w = parseInt(options.w) || Math.floor(0.5*pixels.shape[0]);
|
||||||
var oy = options.y || 0;
|
options.h = parseInt(options.h) || Math.floor(0.5*pixels.shape[1]);
|
||||||
var w = options.w || Math.floor(0.5*pixels.shape[0]);
|
var ox = options.x;
|
||||||
var h = options.h || Math.floor(0.5*pixels.shape[1]);
|
var oy = options.y;
|
||||||
|
var w = options.w;
|
||||||
|
var h = options.h;
|
||||||
var iw = pixels.shape[0]; //Width of Original Image
|
var iw = pixels.shape[0]; //Width of Original Image
|
||||||
var newarray = new Uint8Array(4*w*h);
|
var newarray = new Uint8Array(4*w*h);
|
||||||
for (var n = oy; n < oy + h; n++) {
|
for (var n = oy; n < oy + h; n++) {
|
||||||
|
|||||||
25
src/modules/Crop/info.json
Normal file
25
src/modules/Crop/info.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "Crop",
|
||||||
|
"inputs": {
|
||||||
|
"x": {
|
||||||
|
"type": "integer",
|
||||||
|
"desc": "X-position (measured from left) from where cropping starts",
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"y": {
|
||||||
|
"type": "integer",
|
||||||
|
"desc": "Y-position (measured from top) from where cropping starts",
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"w": {
|
||||||
|
"type": "integer",
|
||||||
|
"desc": "Width of crop",
|
||||||
|
"default": "(50%)"
|
||||||
|
},
|
||||||
|
"h": {
|
||||||
|
"type": "integer",
|
||||||
|
"desc": "Height of crop",
|
||||||
|
"default": "(50%)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5
src/modules/DecodeQr/info.json
Normal file
5
src/modules/DecodeQr/info.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name": "Decode QR",
|
||||||
|
"inputs": {
|
||||||
|
}
|
||||||
|
}
|
||||||
5
src/modules/DoNothing/info.json
Normal file
5
src/modules/DoNothing/info.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name": "Do Nothing",
|
||||||
|
"inputs": {
|
||||||
|
}
|
||||||
|
}
|
||||||
5
src/modules/DoNothingPix/info.json
Normal file
5
src/modules/DoNothingPix/info.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name": "extract pixels, do nothing, and replace",
|
||||||
|
"inputs": {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,13 +28,21 @@ module.exports = function DoNothing(options,UI) {
|
|||||||
selector: "#image-sequencer-canvas"
|
selector: "#image-sequencer-canvas"
|
||||||
});
|
});
|
||||||
|
|
||||||
distorter.lens.a = options.a || distorter.lens.a;
|
options.a = parseFloat(options.a) || distorter.lens.a;
|
||||||
distorter.lens.b = options.b || distorter.lens.b;
|
options.b = parseFloat(options.b) || distorter.lens.b;
|
||||||
distorter.lens.Fx = options.Fx || distorter.lens.Fx;
|
options.Fx = parseFloat(options.Fx) || distorter.lens.Fx;
|
||||||
distorter.lens.Fy = options.Fy || distorter.lens.Fy;
|
options.Fy = parseFloat(options.Fy) || distorter.lens.Fy;
|
||||||
distorter.lens.scale = options.scale || distorter.lens.scale;
|
options.scale = parseFloat(options.scale) || distorter.lens.scale;
|
||||||
distorter.fov.x = options.x || distorter.fov.x;
|
options.x = parseFloat(options.x) || distorter.fov.x;
|
||||||
distorter.fov.y = options.y || distorter.fov.y;
|
options.y = parseFloat(options.y) || distorter.fov.y;
|
||||||
|
|
||||||
|
distorter.lens.a = options.a;
|
||||||
|
distorter.lens.b = options.b;
|
||||||
|
distorter.lens.Fx = options.Fx;
|
||||||
|
distorter.lens.Fy = options.Fy;
|
||||||
|
distorter.lens.scale = options.scale;
|
||||||
|
distorter.fov.x = options.x;
|
||||||
|
distorter.fov.y = options.y;
|
||||||
|
|
||||||
distorter.setImage(input.src,function(){
|
distorter.setImage(input.src,function(){
|
||||||
step.output = {src: canvas.toDataURL(), format: input.format};
|
step.output = {src: canvas.toDataURL(), format: input.format};
|
||||||
|
|||||||
64
src/modules/FisheyeGl/info.json
Normal file
64
src/modules/FisheyeGl/info.json
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
"name": "Fisheye GL",
|
||||||
|
"inputs": {
|
||||||
|
"a": {
|
||||||
|
"type": "float",
|
||||||
|
"desc": "a parameter",
|
||||||
|
"default": 1,
|
||||||
|
"min": 1,
|
||||||
|
"max": 4
|
||||||
|
},
|
||||||
|
"b": {
|
||||||
|
"type": "float",
|
||||||
|
"desc": "b parameter",
|
||||||
|
"default": 1,
|
||||||
|
"min": 1,
|
||||||
|
"max": 4
|
||||||
|
},
|
||||||
|
"Fx": {
|
||||||
|
"type": "float",
|
||||||
|
"desc": "Fx parameter",
|
||||||
|
"default": 0,
|
||||||
|
"min": 0,
|
||||||
|
"max": 4
|
||||||
|
},
|
||||||
|
"Fy": {
|
||||||
|
"type": "float",
|
||||||
|
"desc": "Fy parameter",
|
||||||
|
"default": 0,
|
||||||
|
"min": 0,
|
||||||
|
"max": 4
|
||||||
|
},
|
||||||
|
"scale": {
|
||||||
|
"type": "float",
|
||||||
|
"desc": "Image Scaling",
|
||||||
|
"default": 1.5,
|
||||||
|
"min": 0,
|
||||||
|
"max": 20
|
||||||
|
},
|
||||||
|
"x": {
|
||||||
|
"type": "float",
|
||||||
|
"desc": "FOV x parameter",
|
||||||
|
"default": 1.5,
|
||||||
|
"min": 0,
|
||||||
|
"max": 20
|
||||||
|
},
|
||||||
|
"y": {
|
||||||
|
"type": "float",
|
||||||
|
"desc": "FOV y parameter",
|
||||||
|
"default": 1.5,
|
||||||
|
"min": 0,
|
||||||
|
"max": 20
|
||||||
|
},
|
||||||
|
"fragmentSrc": {
|
||||||
|
"type": "PATH",
|
||||||
|
"desc": "Patht to a WebGL fragment shader file",
|
||||||
|
"default": "(inbuilt)"
|
||||||
|
},
|
||||||
|
"vertexSrc": {
|
||||||
|
"type": "PATH",
|
||||||
|
"desc": "Patht to a WebGL vertex shader file",
|
||||||
|
"default": "(inbuilt)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5
src/modules/GreenChannel/info.json
Normal file
5
src/modules/GreenChannel/info.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name": "Green Channel",
|
||||||
|
"inputs": {
|
||||||
|
}
|
||||||
|
}
|
||||||
5
src/modules/Invert/info.json
Normal file
5
src/modules/Invert/info.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name": "Invert",
|
||||||
|
"inputs": {
|
||||||
|
}
|
||||||
|
}
|
||||||
5
src/modules/NdviRed/info.json
Normal file
5
src/modules/NdviRed/info.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name": "NDVI Red",
|
||||||
|
"inputs": {
|
||||||
|
}
|
||||||
|
}
|
||||||
11
src/modules/SegmentedColormap/info.json
Normal file
11
src/modules/SegmentedColormap/info.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "Segmented Colormap",
|
||||||
|
"inputs": {
|
||||||
|
"colormap": {
|
||||||
|
"type": "select",
|
||||||
|
"desc": "Name of the Colormap",
|
||||||
|
"default": "default",
|
||||||
|
"values": ["default","greyscale","stretched","fastie"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
0
src/modules/Threshold/info.json
Normal file
0
src/modules/Threshold/info.json
Normal file
Reference in New Issue
Block a user