Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ball-morphology

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ball-morphology

Morphological operations with ball shaped structuring elements

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
244
decreased by-0.41%
Maintainers
1
Weekly downloads
 
Created
Source

ball-morphology

Mathematical morphology for ndarrays where the structuring element is a ball in some Lp metric.

Example

First, let's read an image:

var morphology = require("ball-morphology")

require("get-pixels")("bwimage.png", function(err, data) {
  var r = data.pick(-1, -1, 0)
  
  // ... do stuff ...
})

Which gives us the following array:

We can dilate the image using the following command:

morphology.dilate(r, 1)

Which produces the following result:

Similarly, we can also perform an erosion:

morphology.erode(r, 1)

Giving the result:

For convenience, openings and closing are also implemented:

morphology.open(r, 1)
morphology.close(r, 1)

Install

npm install ball-morphology

API

var morphology = require("ball-morphology")

morphology.dilate(array, radius[, p])

Performs a binary morphological dilation with an Lp ball of a given radius

  • array is a binary image (updated in place)
  • radius is the radius of the ball in pixel units (may be fractional)
  • p is an optional argument giving the exponent of the metric. (Default 2)

Returns array

morphology.erode(array, radius[, p])

Performs a binary morphological erosion with an Lp ball of a given radius

  • array is a binary image (updated in place)
  • radius is the radius of the ball in pixel units (may be fractional)
  • p is an optional argument giving the exponent of the metric. (Default 2)

Returns array

morphology.open(array, radius[, p])

Performs a binary morphological opening with an Lp ball of a given radius

  • array is a binary image (updated in place)
  • radius is the radius of the ball in pixel units (may be fractional)
  • p is an optional argument giving the exponent of the metric. (Default 2)

Returns array

morphology.close(array, radius[, p])

Performs a binary morphological closing with an Lp ball of a given radius

  • array is a binary image (updated in place)
  • radius is the radius of the ball in pixel units (may be fractional)
  • p is an optional argument giving the exponent of the metric. (Default 2)

Returns array

Credits

(c) 2013 Mikola Lysenko. MIT License

Keywords

FAQs

Package last updated on 27 Jun 2013

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc