imgthin/lib.rs
1//! A rust image thinning library inspired by
2//!
3//! > A fast parallel algorithm for thinning digital patterns.
4//!
5//! ## Research Abstract
6//!
7//! > A fast parallel thinning algorithm is proposed
8//! > in this paper. It consists of two subiterations: one aimed at
9//! > deleting the south-east boundary points and the north-west
10//! > corner points while the other one is aimed at deleting the
11//! > north-west boundary points and the south-east corner
12//! > points. End points and pixel connectivity are preserved.
13//! > Each pattern is thinned down to a "skeleton" of unitary
14//! > thickness. Experimental results show that this method is
15//! > very effective.
16//!
17//! - [A fast parallel algorithm for thinning digital patterns](https://www-prima.inrialpes.fr/perso/Tran/Draft/gateway.cfm.pdf)
18//! [A modified fast parallel algorithm for thinning digital patterns](https://www.researchgate.net/publication/222456229)
19//!
20//! # Installation
21//!
22//! Add `imgthin` as a dependency to the `Cargo.toml` file.
23//!
24//! To use the original algorithm from Zhang and Suen:-
25//!
26//! ```toml
27//! # Cargo.toml
28//!
29//! imgthin = "0.1.1"
30//! ```
31//!
32//! To use the improved algorithm from Yung Sheng and Wen-Hsing:-
33//!
34//! ```toml
35//! # Cargo.toml
36//!
37//! imgthin = {version = "0.1.1", features=["improved_ysc_whh"]}
38//!
39//! ```
40//!
41//! ## Usage
42//!
43//! ```rust
44//! use imgthin::imgthin;
45//!
46//! // _________ Vec<Vec<bool>>
47//! // v
48//! let thinned = imgthin(vec!(
49//! vec!(false, false, true, true, false),
50//! vec!(false, false, true, true, false),
51//! vec!(false, false, true, true, false)
52//! )).expect("Can not thin the image.");
53//!
54//! ```
55//!
56
57#[cfg(feature = "improved_ysc_whh")]
58mod ysc_whh;
59#[cfg(feature = "improved_ysc_whh")]
60pub use ysc_whh::*;
61
62#[cfg(not(feature = "improved_ysc_whh"))]
63mod default;
64#[cfg(not(feature = "improved_ysc_whh"))]
65pub use default::*;
66
67mod bin_image;
68
69mod common;