Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/contour2d
Extracts a rectilinear polygon contour from a binary image
https://github.com/mikolalysenko/contour2d
Last synced: about 2 months ago
JSON representation
Extracts a rectilinear polygon contour from a binary image
- Host: GitHub
- URL: https://github.com/mikolalysenko/contour2d
- Owner: mikolalysenko
- License: mit
- Created: 2014-01-27T19:13:44.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-04-29T01:00:20.000Z (over 10 years ago)
- Last Synced: 2024-10-20T14:28:20.242Z (2 months ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 22
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
contour-2d
==========
Extracts a 2D rectilinear polygon from a binary image encoded as an ndarray. Works in node.js and browserify.## Example
```javascript
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