Socket
Book a DemoInstallSign in
Socket

contour-2d

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

contour-2d

Extracts the boundary of a binary 2D image

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

contour-2d

Extracts a 2D rectilinear polygon from a binary image encoded as an ndarray. Works in node.js and browserify.

Example

var pack = require("ndarray-pack")
var contour2D = require("contour-2d")

//Get a contour
console.log(contour2D(pack([
  [1, 1, 1, 0, 0],
  [1, 0, 1, 1, 1],
  [1, 1, 1, 1, 1]
])))

//Prints out:
//  
//  [ [ [ 0, 0 ],
//      [ 0, 3 ],
//      [ 5, 3 ],
//      [ 5, 1 ],
//      [ 3, 1 ],
//      [ 3, 0 ] ],
//    [ [ 2, 1 ],
//      [ 2, 2 ],
//      [ 1, 2 ],
//      [ 1, 1 ] ] ]
//

Install

npm install contour-2d

API

require("contour-2d")(image[, flip])

Extracts a contour polygon from the image.

  • image is a binary ndarray
  • flip is an optional flag, which if set reverse the orientations of the loops

Returns A list of loops representing the oriented boundary of the polygon.

Credits

(c) 2014 Mikola Lysenko. MIT License

Keywords

binary

FAQs

Package last updated on 29 Apr 2014

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