Skip to main content

handwriting_recognize

Function handwriting_recognize 

Source
pub fn handwriting_recognize(
    model_path: &str,
    strokes: &[Vec<(f32, f32)>],
    width: f32,
    height: f32,
) -> Result<Vec<String>>
Expand description

Recognise one character drawn as strokes of (x, y) points on a width by height canvas, returning up to 12 candidates ordered by order_handwriting_candidates. model_path is a trusted packaged zinnia model such as handwriting-zh_CN.model.

As the bridge did: an empty path or no points at all returns no candidates without opening the model, and trailing empty strokes are dropped while an empty stroke between two others is an invalid stroke. Errors carry the reference’s messages: a model that cannot be opened is Failed, a canvas, stroke or point outside the limits is InvalidArgument.