r2d4 / osrs-ocr

7 stars 1 forks source link

Cant read HP value from client #1

Open jonatino opened 1 year ago

jonatino commented 1 year ago

I'm trying to read current hp levels from the rs client but when I try to use any of the models in your repo I get close, but incorrect values.

    let mut lt = LepTess::new(None, "osrs3").unwrap();

    lt.set_image_from_mem(&tiff_buffer).unwrap();
    lt.set_variable(Variable::TesseditCharWhitelist, "0123456789").unwrap();
    lt.set_source_resolution(240);

    println!("Hp is '{}'", lt.get_utf8_text().unwrap());

Image being ocr'ed: kek

Text output from ocr: osrs: Hp is '53' osrs2: Hp is '323' osrs3: Hp is '3' osrs-ft: Hp is '7'

Any advice for getting a correct reading?

r2d4 commented 1 year ago

You could try some of the tricks from:

https://tesseract-ocr.github.io/tessdoc/ImproveQuality.html

What worked best for me was applying a mask or thresholding (https://docs.opencv.org/4.x/d7/d4d/tutorial_py_thresholding.html) and rescaling