ndarray-gaussian-filter
Advanced tools
Comparing version 0.0.0 to 1.0.0
"use strict" | ||
var lena = require("luminance")(require("lena")) | ||
var baboon = require("luminance")(require("baboon-image")) | ||
var savePixels = require("save-pixels") | ||
var blur = require("../gauss") | ||
savePixels(blur(lena, 5), "png").pipe(process.stdout) | ||
savePixels(blur(baboon, 5), "png").pipe(process.stdout) |
15
gauss.js
@@ -6,3 +6,3 @@ "use strict" | ||
var ndarray = require("ndarray") | ||
var bits = require("bit-twiddle") | ||
var nextPow2 = require("next-pow-2") | ||
var ops = require("ndarray-ops") | ||
@@ -22,3 +22,3 @@ var fft = require("ndarray-fft") | ||
} else { | ||
this.w[i] = -Math.pow(Math.PI * sigma[i] / n[i], 2) | ||
this.w[i] = -2*Math.pow(Math.PI * sigma[i] / n[i], 2) | ||
} | ||
@@ -45,2 +45,5 @@ } | ||
} | ||
if(!Array.isArray(sigma)) { | ||
sigma = dup(arr.dimension, sigma) | ||
} | ||
for(var i=0; i<arr.dimension; ++i) { | ||
@@ -50,3 +53,3 @@ if(wrap[i]) { | ||
} else { | ||
padded[i] = bits.nextPow2(arr.shape[i]) | ||
padded[i] = nextPow2(arr.shape[i] + 2*Math.ceil(3*sigma[i])) | ||
} | ||
@@ -62,7 +65,3 @@ nsize *= padded[i] | ||
fft(1, re, im) | ||
if(Array.isArray(sigma)) { | ||
gaussFilter(re, im, sigma) | ||
} else { | ||
gaussFilter(re, im, dup(arr.dimension, sigma)) | ||
} | ||
gaussFilter(re, im, sigma) | ||
fft(-1, re, im) | ||
@@ -69,0 +68,0 @@ ops.assign(arr, re_top) |
{ | ||
"name": "ndarray-gaussian-filter", | ||
"version": "0.0.0", | ||
"version": "1.0.0", | ||
"description": "Gaussian filter for ndarrays", | ||
@@ -9,24 +9,32 @@ "main": "gauss.js", | ||
}, | ||
"browserify": { | ||
"transform": [ | ||
"cwise" | ||
] | ||
}, | ||
"dependencies": { | ||
"bit-twiddle": "^0.0.2", | ||
"cwise": "^0.4.0", | ||
"dup": "^0.0.0", | ||
"ndarray": "^1.0.10", | ||
"ndarray-fft": "^0.1.0", | ||
"ndarray-ops": "^1.2.1", | ||
"typedarray-pool": "^0.1.2" | ||
"next-pow-2": "^1.0.0", | ||
"cwise": "^1.0.7", | ||
"dup": "^1.0.0", | ||
"ndarray": "^1.0.18", | ||
"ndarray-fft": "^1.0.0", | ||
"ndarray-ops": "^1.2.2", | ||
"typedarray-pool": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"lena": "^1.0.0", | ||
"luminance": "^1.0.2", | ||
"save-pixels": "^0.3.0" | ||
"baboon-image": "^2.0.0", | ||
"luminance": "^1.0.3", | ||
"save-pixels": "^2.2.0", | ||
"tape": "^4.0.0", | ||
"test-fuzzy-array": "^1.0.1" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "tape test/*.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/mikolalysenko/ndarray-gaussian-filter.git" | ||
"url": "git://github.com/scijs/ndarray-gaussian-filter.git" | ||
}, | ||
"keywords": [ | ||
"scijs", | ||
"ndarray", | ||
@@ -38,7 +46,9 @@ "gaussian", | ||
"author": "Mikola Lysenko", | ||
"contributors": [ | ||
"Jasper van de Gronde <th.v.d.gronde@hccnet.nl>" | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/mikolalysenko/ndarray-gaussian-filter/issues" | ||
}, | ||
"homepage": "https://github.com/mikolalysenko/ndarray-gaussian-filter" | ||
"url": "https://github.com/scijs/ndarray-gaussian-filter/issues" | ||
} | ||
} |
@@ -5,28 +5,28 @@ ndarray-gaussian-filter | ||
# Example | ||
[![build status](https://secure.travis-ci.org/scijs/ndarray-gaussian-filter.png)](http://travis-ci.org/scijs/ndarray-gaussian-filter) | ||
## Example | ||
```javascript | ||
var lena = require("luminance")(require("lena")) | ||
var baboon = require("luminance")(require("baboon-image")) | ||
var savePixels = require("save-pixels") | ||
var blur = require("ndarray-gaussian-filter") | ||
savePixels(blur(lena, 5), "png").pipe(process.stdout) | ||
savePixels(blur(baboon, 5), "png").pipe(process.stdout) | ||
``` | ||
Writes the following png to stdout: | ||
#### Output | ||
![Output](example/blur.png) | ||
<img src="https://raw.github.com/mikolalysenko/ndarray-gaussian-filter/master/example/blur.png"> | ||
## Install | ||
Install using [npm](https://www.npmjs.com/): | ||
# Install | ||
npm install ndarray-gaussian-filter | ||
``` | ||
npm install ndarray-gaussian-filter | ||
``` | ||
## API | ||
# API | ||
### `require("ndarray-gaussian-filter")(array,radius[,wrap])` | ||
#### `require("ndarray-gaussian-filter")(array,radius[,wrap])` | ||
Filters an ndarray using a Gaussian filter. | ||
* `array` is an ndarray | ||
* `sigma` is the radius of the Gaussian filter. Can be either a scalar or array | ||
* `array` is an ndarray. | ||
* `sigma` is the radius of the Gaussian filter. Can be either a scalar or an array. | ||
* `wrap` is checks whether the filter is applied as a circular convolution or uses `0` boundary. Default is `false`. Can be set as an array to select boundary conditions independently for each axis. | ||
@@ -36,3 +36,3 @@ | ||
# Credits | ||
## License | ||
(c) 2014 Mikola Lysenko. MIT License |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
9
119
1
183993
5
1
+ Addednext-pow-2@^1.0.0
+ Addedacorn@7.4.1(transitive)
+ Addedalign-text@0.1.4(transitive)
+ Addedamdefine@1.0.1(transitive)
+ Addedbit-twiddle@1.0.2(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedcamelcase@1.2.1(transitive)
+ Addedcenter-align@0.1.3(transitive)
+ Addedcliui@2.1.0(transitive)
+ Addedconcat-stream@1.6.2(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedcwise@1.0.10(transitive)
+ Addedcwise-parser@1.0.3(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addeddup@1.0.0(transitive)
+ Addedduplexer2@0.0.2(transitive)
+ Addedescodegen@0.0.281.3.3(transitive)
+ Addedesprima@1.1.11.2.5(transitive)
+ Addedestraverse@1.3.21.5.1(transitive)
+ Addedesutils@1.0.0(transitive)
+ Addedfalafel@2.2.5(transitive)
+ Addedhas@1.0.4(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@0.0.11.0.02.0.5(transitive)
+ Addedkind-of@3.2.2(transitive)
+ Addedlazy-cache@1.0.4(transitive)
+ Addedlongest@1.0.1(transitive)
+ Addedminimist@0.0.8(transitive)
+ Addedndarray-fft@1.0.3(transitive)
+ Addednext-pow-2@1.0.0(transitive)
+ Addedobject-inspect@0.4.0(transitive)
+ Addedobject-keys@0.4.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedquote-stream@0.0.0(transitive)
+ Addedreadable-stream@1.0.341.1.142.3.8(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedright-align@0.1.3(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedshallow-copy@0.0.1(transitive)
+ Addedsource-map@0.1.430.5.7(transitive)
+ Addedstatic-eval@0.2.4(transitive)
+ Addedstatic-module@1.5.0(transitive)
+ Addedstring_decoder@0.10.311.1.1(transitive)
+ Addedthrough2@0.4.2(transitive)
+ Addedtypedarray@0.0.6(transitive)
+ Addedtypedarray-pool@1.2.0(transitive)
+ Addeduglify-js@2.8.29(transitive)
+ Addeduglify-to-browserify@1.0.2(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwindow-size@0.1.0(transitive)
+ Addedwordwrap@0.0.2(transitive)
+ Addedxtend@2.1.2(transitive)
+ Addedyargs@3.10.0(transitive)
- Removedbit-twiddle@^0.0.2
- Removedbit-twiddle@0.0.2(transitive)
- Removedcwise@0.3.40.4.0(transitive)
- Removedcwise-compiler@0.0.00.1.0(transitive)
- Removedcwise-parser@0.0.1(transitive)
- Removeddup@0.0.0(transitive)
- Removedndarray-fft@0.1.0(transitive)
- Removedndarray-ops@1.1.1(transitive)
- Removedtypedarray-pool@0.1.2(transitive)
- Removeduniq@0.0.2(transitive)
Updatedcwise@^1.0.7
Updateddup@^1.0.0
Updatedndarray@^1.0.18
Updatedndarray-fft@^1.0.0
Updatedndarray-ops@^1.2.2
Updatedtypedarray-pool@^1.1.0