SRL Archive - RS3 Intermediate Scripting Tutorials

A Pragmatic Approach to Reading Text with Tesseract


argothes

2019-02-14 19:50:29

Great tutorial, I didn't even know the TesseractTool existed. Have you had any luck using this approach on non-black and dynamic backgrounds? I'm writing a bot for a non-RS game that relies heavily on OCR, and I've been having really poor performance due to the dynamic background the text is on. I can simply subtract all pixels which have shifted to eliminate this problem, but I can't seem to find a built-in way to do that with Simba, even with SRL-6. I'm probably going to switch to a Python implementation soon, which is too bad because I love using Simba for all of my botting needs :(

Sin

2019-02-15 20:31:02

From: argothes
Great tutorial, I didn't even know the TesseractTool existed. Have you had any luck using this approach on non-black and dynamic backgrounds? I'm writing a bot for a non-RS game that relies heavily on OCR, and I've been having really poor performance due to the dynamic background the text is on. I can simply subtract all pixels which have shifted to eliminate this problem, but I can't seem to find a built-in way to do that with Simba, even with SRL-6. I'm probably going to switch to a Python implementation soon, which is too bad because I love using Simba for all of my botting needs :(


Tesseract (https://github.com/tesseract-ocr/) was originally created as an AIO text reader, so it's not limited to Simba/Runescape at all! As for dynamic backgrounds, if the color of your text is static, then you can replace the pixel value of every non-text color to black and have Tesseract search that. If that's not the case, then you can calculate the horizontal/vertical gradient (https://en.wikipedia.org/wiki/Image_gradient) of the pixel change and have Tesseract run that. Also, you can use Simba with Python, check out PyMML on Wizzup's github. It has all the color finding techniques that are regularly used in Simba.

Citrus

2019-02-15 22:17:36

From: argothes
Great tutorial, I didn't even know the TesseractTool existed. Have you had any luck using this approach on non-black and dynamic backgrounds? I'm writing a bot for a non-RS game that relies heavily on OCR, and I've been having really poor performance due to the dynamic background the text is on. I can simply subtract all pixels which have shifted to eliminate this problem, but I can't seem to find a built-in way to do that with Simba, even with SRL-6. I'm probably going to switch to a Python implementation soon, which is too bad because I love using Simba for all of my botting needs :(


Here is a plugin that will let you deal with shifted pixels: https://villavu.com/forum/showthread.php?t=114550&p=1358842#post1358842
If you could post some images of the the problematic text, others could chip in and do some tests of their own.