blob-detection-mser

0.0.11 • Public • Published

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

^ input

output

^ output

See Also

Package Sidebar

Install

npm i blob-detection-mser

Weekly Downloads

1

Version

0.0.11

License

MIT

Unpacked Size

12.9 kB

Total Files

5

Last publish

Collaborators

  • stonkpunk