Contour tracing library
A 2D library to trace contours.
How it works in a live demo: https://stpr.github.io/contour_tracing/
Features
Core features:
- Trace contours using the Theo Pavlidis' algorithm (connectivity: 4-connected)
- Trace outlines in clockwise direction
- Trace holes in counterclockwise direction
- Input format: a 2D array of bits or an image buffer
- Output format: a string of SVG Path commands
Manual parameters:
- User can specify to close or not the paths (with the SVG Path Z command)
An example with an array of bits
- Add the following line to your Cargo.toml file in the dependencies section:
contour_tracing = { version = "*", features = ["array"] }
- Then use the library:
use bits_to_paths;
An example with an image buffer
- Add the following line to your Cargo.toml file in the dependencies section:
contour_tracing = { version = "*", features = ["image"] }
- Then use the library:
use ;
use single_l8_to_paths;
Both examples should print: M0 0H1V1H0ZM1 1H2V2H1ZM2 2H3V3H2Z
For more examples, have a look at the documentation:
License
Contour tracing library https://github.com/STPR/contour_tracing
Copyright (c) 2022, STPR - https://github.com/STPR
SPDX-License-Identifier: EUPL-1.2
Contribution
Your contribution is highly appreciated. Do not hesitate to open an issue or a pull request. Note that any contribution submitted for inclusion in the project will be licensed according to the terms given in LICENSE.txt.