A porting of leptonica pagesegtest1.c.
Install before building
sudo apt install libclang-10-dev libleptonica-dev
Run
cargo build
Run
cargo run pageseg1.tif
Then, /tmp/lept/pageseg/debug.pdf
will be created.
Create bilevel gray image
convert -verbose -type bilevel -depth 1 input.jpg output.tif