Search the Community
Showing results for tags 'Screen scraping'.
In response to this: http://www.woodus.com/forums/index.php?showtopic=30162 I've developed a script that allows you to capture a region of the screen, send it to an OCR(Tesseract in this case), and optionaly send the scraped text to Google Translate. The latter option for the moment is more or less useless. I've only included it to see if I could do it, and in the hope that it may one day be useful. At some point I might include other online translators, but that is in the distant future. For now, I'd like to concentrate on Tesseract's precision. Not so much it's ability to recognize characters accurately, but its ability to recognize characters consistently. If it can do this, then there is hope for the project. So long as 12345 is always translated as q325tu, and "q325tu" is unique, then a database can be built up and ã€Œtranslated.ã€ I think that this could be be used for ã€Œtranslatingã€ the menu and sub menus. It could potentially be used to ã€Œtranslateã€ NPC text as well, but that's a massive undertaking for the translators. Those of you interested in testing: Install Mono and Tesseract. Save the following as dqxscreen.cs (Or whatever you want to. Just be sure to change the corresponding text in the appropriate places.) Change the reference noted below to tesseract executable.* (Note, this works as is on Linux) *Might work as is with Windows. Not sure, I've been corresponding with Woodus on this, and I don't know if he changed the path. I think he probably did. Compile with: gmcs -r:System.Windows.Forms.dll -r:System.Drawing.dll ./dqxscreen.cs Run with: mono dqxscreen.cs Optionally run this: mozroots --import --ask-remove If that doesn't work try: mono mozroots --import --ask-remove or: mozroots.exe --import --ask-remove or: mono mozroots.exe --import --ask-remove (One of those has to work, right? ) Info here: http://www.mono-project.com/docs/faq/security/ This is to get the web interface to work. It grabs the default certificates from a mozilla installation. If you don't plan on trying out Google translate, you can skip this. (I've been able to get this to work for me, but it hasn't been tested on Windows yet.) Press Z and X to change the mouse coordinates. Z is that's intended as the upper part of the window. X is the lower. It can be fine tuned using the buttons to adjust the coordinates. One note: I've noticed that the output of the OCR is different depending on how much space is given for the characters. Giving it a 1px margin vs 10px+ seems to give a mostly consistent, but not entirely consistent reading. I haven't had the time to see if I can script my way around this. It'll probably involve automating the GIMP to add a border around the text. There's a few thing I'd like to experiment around with when I get the chance to see if consistency can be improved. Also, for those interested in improving the accuracy: Tesseract will probably have to be trained. It's not strictly necessary, and we should probably focus on increasing the precision first, but don't let me stop you. If every thing works out, it may eventually be useful. So, here's what I need the testers to do: Take screen shots of the entire game with menus open. Post them here. Use the application to capture the Japanese text, and post that here under the picture. Do the same for other screen shots that others have posted, noting the link of the screen shot. Also, please note if you were close to the text, or allowed for more padding. Here's an example: I've tried to work out as many errors as I've seen, but there may still be a few lurking here and there and I think I might have just found a bug. I'll revisit my code on the weekend. It has to do with the y+-1 buttons. It's probably a simple error, but I don't have time to look at it at the moment. *Sigh* Without further ado, the code: Thanks for making it to the end! And for those of you who didn't, you're welcome! Pleasant dreams! :snooze: