Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fujiharuka/node-maxmin-filter
Max-Min Filter of image implemented in JavaScript
https://github.com/fujiharuka/node-maxmin-filter
Last synced: 5 days ago
JSON representation
Max-Min Filter of image implemented in JavaScript
- Host: GitHub
- URL: https://github.com/fujiharuka/node-maxmin-filter
- Owner: FujiHaruka
- License: mit
- Created: 2017-02-15T13:01:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T08:14:21.000Z (almost 2 years ago)
- Last Synced: 2024-04-13T19:32:02.478Z (7 months ago)
- Language: JavaScript
- Size: 753 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-maxmin-filter
Max-Min filter of image implemented in JavaScript. Both in Node.js and browser.
+ [Demo](https://fujiharuka.github.io/node-maxmin-filter/demo.html)
## Install
```
$ npm install maxmin-filter
```## Usage
I made it as an [ndarray](https://github.com/scijs/ndarray) module. So, the simplest usage is with [get-pixels](https://github.com/scijs/get-pixels) and [save-pixels](https://github.com/scijs/save-pixels) as below.
```js
const fs = require('fs')
const savePixels = require('save-pixels')
const getPixels = require('get-pixels')
const maxminFilter = require('maxmin-filter')getPixels('src.png', (err, pixels) => {
if (err) {
throw err
}
let filtered = maxminFilter(pixels)
savePixels(filtered, 'png').pipe(fs.createWriteStream('dist.png'))
})
```## API
### `maxminFilter(pixels[, options])`
Returns a thresholded ndarray.
* `pixels` - an ndarray whose shape is [width, height, channels].
* `options.size` - the filter size.