Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/bitmap-to-boxes
Partitions a 2D binary image into rectangles
https://github.com/mikolalysenko/bitmap-to-boxes
Last synced: about 2 months ago
JSON representation
Partitions a 2D binary image into rectangles
- Host: GitHub
- URL: https://github.com/mikolalysenko/bitmap-to-boxes
- Owner: mikolalysenko
- License: mit
- Created: 2014-01-27T20:11:20.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-04-29T01:01:46.000Z (over 10 years ago)
- Last Synced: 2024-10-19T00:19:26.152Z (2 months ago)
- Language: JavaScript
- Size: 136 KB
- Stars: 9
- Watchers: 6
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
bitmap-to-boxes
===============
Partitions a binary image into a non-overlapping collection of rectangles. Works both in node.js and in browserify.## Example
```javascript
var image = require("ndarray-pack")([
[1, 1, 0, 0, 0, 1],
[0, 1, 1, 1, 0, 1],
[0, 1, 0, 1, 0, 1],
[0, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1],
[1, 1, 1, 0, 0, 1]
])var boxes = require("bitmap-to-boxes")(image)
```## Install
```
npm install bitmap-to-boxes
```## API
### `require("bitmap-to-boxes")(image[, greedy])`
Decomposes the binary bitmap image into a collection of boxes.* `image` is a binary 2D [ndarray](https://github.com/mikolalysenko/ndarray)
* `greedy` is an optional flag, which if set uses a faster greedy approximation instead of an optimal algorithm.**Returns** A list of boxes encoded by their lower/upper bounds respectively which partition the image.
## Credits
(c) 2014 Mikola Lysenko. MIT License