Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Pattern detection using Local Binary Patterns algorithm
http://en.wikipedia.org/wiki/Local_binary_patterns
npm install lbp
or
// put library in your javascript root directory
<script src="{js directory}/lbp/lib/LBP.js"></script>
<script>
var lbp = new LBP();
...
</script>
// image data (two dimensional array of pixel values in gray scale)
var data = [
[6,5,2, ...],
[7,6,1, ...],
[9,8,7, ...],
...
];
var lbp = new LBP(data, 8, 1); // 8 is number of sampling points, 1 is radius
// calculate LBP, contrast and variance for pixel at position [1,1]
console.log(lbp.calculate(1, 1));
// calculate LBP distribution, contrast and variance for whole image
console.log(lbp.distribution());
By default, library is using rotation independent binary patterns. It means, all following patterns will be rotated to one uniform pattern:
1100 0000 -> 0000 0011
0000 1100 -> 0000 0011
1000 0001 -> 0000 0011
If you want to desable this behaviour, please set LBP.rotationInvariantLBPs
to false
.
TODO
For better performance library uses local memory for storing calculation results. If you want to use your own memory adapter, it should implement following interface:
MyAdapter.prototype.set = function(key, value) {};
MyAdapter.prototype.get = function(key) {}; // returns null if key is not found
// assign custom memory adapter
LBP.memory = new MyAdapter();
If you'd like to contribute, open an issue ticket or send pull request.
mocha -R spec
FAQs
Pattern detection using Local Binary Patterns algorithm
The npm package lbp receives a total of 1 weekly downloads. As such, lbp popularity was classified as not popular.
We found that lbp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.