-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage on a Mac... #2
Comments
Okay, I managed to install all the pre-requisites, and get the program to do an "initialize" run by hovering the mouse over the various areas and pressing return, so that it could record the mouse pointer position. That information was saved. However, when trying to do a normal run, I get the following error:
As you can see, the mouse position X and Y parameters are being saved as floats, not ints. So, I changed the code to read:
And we get past that error. However, python itself then proceeds to crash, and BGNRRG.py appears to hang. See http://imgur.com/a/niWGU. When I stop BGNRRG.py with a control-C, I get the following error:
I'm not sure what I can do to debug this issue further. ;( |
Thanks for feedback. Good point with the float. The second thing seems to be some error in pyscreenshot library, however, it doesn't seem to be revealing. After further googling, found possible issue, as the last line shows, something is wrong with multiprocessing: |
I have pyscreenshot 0.4.2 installed, which supposedly includes the patch for ponty/pyscreenshot#38, so we should be avoiding these problems. Yes? |
They say that |
How would I make that modification? So far as I can tell, you're not using ImageGrab.grab, so I don't see how this option would be passed down? |
change |
Well, that did get us past the IDLE problem. However, I now have a new one:
|
Well, I guess that is correct response from code, the value must be single number, right? It seems like tesseract is reading more numbers in the small screenshot that is taken. Just question, are you setting topright and topleft corner of the total-sum button correctly? I will try to add option to export these screenshots so you could see them. |
I did properly hover over top-left and bottom-right of the total sum area (there's no button). I just re-tested that, and got the same type of error. |
Interesting observation -- when I have a character visible that comes to a total of 77, I get the following error:
However, when I have a character loaded (from pressing the Recall button) that sums up to 93, I get the following:
See the difference? That first number of the second line (after the "\n") appears to be what is being recognized, there's just a lot of extra stuff being returned that I don't understand. |
Hmm. The change in cd89b2b doesn't seem to include the code for Shouldn't that go on line 114? |
Okay, adding that to line 114 gets me past the same old IDLE crash that I had been having before, but I still have the problem with weird data being returned for
Note that this was with a character on the BGEE screen which added up to a total of 79. |
Also note that the If they have installed For more information on |
Cool. Thanks! |
That's weird. Witness:
Note: Joining line 75 onto the end of line 74 fixes this problem. |
However, now we have a new problem that I haven't seen before:
|
Sorry, pushed second fix and modified readme. (weird, github is automatically closing issues? Or did I clicked on "close and comment" instead of comment?) Can you please initialize BGNRRG and then run |
I'll give that a shot. |
Sorry, still bombing on line 39:
|
That is because I am writing whole dictionary, not just buttons that I set, I should really stop making changes when I can't test it:/ Pushed another commit, should be working now. |
Okay, managed to fix that code. Try this diff:
|
FYI, here's my config.txt that was generated:
I'm assuming these are being stored in "label X Y" format, right? But certainly, those PNGs are whacked. The top left of the area is being tracked and captured correctly, but not the bottom right! |
Bah, seems like another Mac-specific bug in Would you be so kind to write simple test case using |
Doing a EDIT: Since the PNG is white and doesn't show up on a white background, I'll include the filename here: https://cloud.githubusercontent.com/assets/1151895/24378559/fe6b8cb4-1308-11e7-88cf-1e6cef36e8ec.png |
Okay, I hacked your
Note that the second pair of numbers being passed to The filename is https://cloud.githubusercontent.com/assets/1151895/24378808/f031bdb6-1309-11e7-80fd-3418ec54210b.png EDIT: note that the PNG is actually twice the size requested -- I think that's because I'm using a Retina screen which has an actual resolution of something like 150dpi, instead of the normal 72dpi. But macOS compensates for that and handles the translation both ways. It grabs what we actually want, we just have to deal with the fact that the file is larger than we would normally expect. |
So in Mac it is additive, not absolute. I will report this to |
Okay, I made a minor change to temporarily handle the relative size issue, and now I've got it capturing a number of reasonable images. Here's the diff:
Here's the config.txt:
And here are the files captured by the command |
I'm guessing now that I need to run the retraining process? EDIT: Confirmed. I did a training run with 100 grabs, and it is mis-recognizing EDIT2: More accurately, it is mis-recognizing So, how do I feed this information back to |
When I do a run in non-training mode, it doesn't seem to actually be clicking on the buttons, although it is recognizing some sort of value being returned by |
Please, read the help in "training", I should probably change the name, its not really "training", but it shows what kind of values tesseract it is reading. I will try to write something about it on weekend. In the meantime, would you please be so kind and help us debug underlying libraries? As devs not I have access to mac. I could easily write fix, but I don't have access to mac to test it:/ Thanks! |
Okay, that's doubly weird. I had un-commented the lines to save the maximum value PNGs, and that appears to have been what was causing the clicks on the reroll button to fail. Comment those lines back out, and now it can actually click on the reroll button. It's still mis-recognizing the 9s and 5s, but we're really, really close! |
Because it is OCR, it there will be still some failure rate. We would have to make another training dataset and create bgee3.traineddata with bigger weight on 9 and 5. And again and again, until we have low failure rate. I need to think about automating this process. |
Okay, so reading the documentation at https://github.com/tesseract-ocr/tesseract/wiki/ImproveQuality, it seems that there are some things we can do to the input images to help I also found some useful examples at https://stackoverflow.com/questions/9480013/image-processing-to-improve-tesseract-ocr-accuracy. In this specific case, I believe that the most useful things for us to do would be to convert the image from color to grayscale, and then to maximize the contrast and remove the background noise in the image. Doing some searching around, it seems that OpenCV could be a good choice for these functions. Specifically, the example for converting to grayscale is at http://docs.opencv.org/master/df/d9d/tutorial_py_colorspaces.html, and the image thresholding example is at http://docs.opencv.org/master/d7/d4d/tutorial_py_thresholding.html. The thresholding example with However, what I have not yet worked out is how to convert the image type returned by |
Alas... I was hoping this would end in solution. Ah, well. |
I'm trying out your program on my Mac, and I've discovered that
tesseract
can be installed using thebrew
package manager.My "tessdata" folder is in
/usr/local/Cellar/tesseract/3.05.00/share/tessdata/
.The text was updated successfully, but these errors were encountered: