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

#[cfg(feature = "improved_ysc_whh")]
mod ysc_whh;
#[cfg(feature = "improved_ysc_whh")]
pub use ysc_whh::*;

#[cfg(not(feature = "improved_ysc_whh"))]
mod default;
#[cfg(not(feature = "improved_ysc_whh"))]
pub use default::*;

mod bin_image;

mod common;