6 releases

0.4.1 Oct 20, 2023
0.4.0 Oct 17, 2023
0.3.0 Jun 17, 2023
0.2.3 Nov 7, 2022
0.2.2 Oct 9, 2022

#300 in Images

MIT license

17KB
224 lines

Crate paddleocr

A simple wrapper for hiroi-sora/PaddleOCR-json.

Usage

let mut p = paddleocr::Ppocr::new(
    PathBuf::from(".../PaddleOCR-json.exe"), // path to binary
    Default::default(), // language config_path, default `zh_CN`
)
.unwrap(); // initialize

let now = std::time::Instant::now(); // benchmark
{
    // OCR files
    println!("{}", p.ocr(Path::new(".../test1.png").into()).unwrap());
    println!("{}", p.ocr(Path::new(".../test2.png").into()).unwrap());
    println!("{}", p.ocr(Path::new(".../test3.png").into()).unwrap());

    // OCR clipboard
    println!("{}", p.ocr_clipboard().unwrap());    
}
println!("Elapsed: {:.2?}", now.elapsed());

Use ocr_and_parse to get structured results.

By enabling the bytes feature, you can pass image data as a byte array (AsRef<[u8]>).

Dependencies

~0.7–1.6MB
~35K SLoC