ddddocr 0.1.0

Rust implementation of OCR for captcha recognition, ported from Python ddddocr
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use {ddddocr::DdddOcr, tokio::fs::read};

#[tokio::test]
async fn test_ocr_classification() {
    // Load the ONNX model and charset
    let mut ocr = DdddOcr::new("ddddocr.onnx").expect("Failed to load OCR model");

    // Load test image
    let image_data = read("test.png").await.expect("Failed to read test image");

    // Perform classification and get string result
    let result = ocr
        .classification(&image_data)
        .await
        .expect("Classification failed");

    assert_eq!("消息", result);
}