blob-detection-mser
v0.0.11
Published
NPM version of Sylvain Foucher's Javascript implementation of Maximally Stable Extremal Regions (MSER) algorithm
Downloads
1
Readme
blob-detection-mser
NPM version of Sylvain Foucher's Javascript implementation of Maximally Stable Extremal Regions (MSER) algorithm, with some small changes.
Install
$ npm install blob-detection-mser
Description
This implementation is intended for realtime MSER detection in Node.js, using an object similar to canvas ImageData - {data: [R,G,B,A, R,G,B,A, ...], width, height}
.
For algorithm parameters, please read this article.
The extract method returns an array with detected regions.
Usage
var MSER = require('blob-detection-mser');
var mser = new MSER({
delta: 2,
minArea: 0.001,
maxArea: 0.5,
maxVariation: 0.5,
minDiversity: 0.33
});
var imageData = require('image-sync').read('./lorem-ipsum.jpg');
var rects = mser.extract(imageData).map(function(region) {
return region.rect; // use only regions rect
});
rects = mser.mergeRects(rects); //merge results
//draw results to image
rects.map(function(rect){
var rgba = [255,0,0,255];
mser.drawRectOutline(rect, rgba, imageData)
});
//save resulting image
imageData.saveAs("./output.png")
^ input
^ output