bustiiing / blazingstars

Automatically exported from code.google.com/p/blazingstars
0 stars 0 forks source link

Pot size reading needs improvement at smaller window sizes. #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Pot-size betting requires reading the pot size from the PokerStars window.
 This is done by scraping the area of the screen that contains the pot size
for the current window, manipulating the image using ImageMagick, and then
performing OCR on the resulting image with the Tesseract-OCR engine.  This
process works fairly well on medium to large size poker windows with the
supported themes, but often fails when the window is shrunk.  This may
require tweaking the usage of IM and Tesseract, or it may require ripping
out the entire pot-sized betting method and re-doing it another way.  

I can't honestly think of another way to do it, though.

Original issue reported on code.google.com by steven.h...@gmail.com on 20 Dec 2009 at 11:25

GoogleCodeExporter commented 8 years ago
I discussed this with a friend of mine who has done some work with real-time 
screenscraping. He suggested looking for shortcuts. For example, the pot size 
is 
always a number, and always in a certain font, and for a given theme, is a 
fixed 
color. These factors vastly reduce the number of possibilities.

An option he suggested is turning the image into 2-tone (black and white), then 
searching for given pixel combinations. Perhaps this could work for small 
window 
sizes.

I've noticed that PokerStars turns off auto-aliasing for the pot size when the 
window 
is under a certain size. That makes pattern matching on a pixel-basis possibly 
workable. 

Original comment by steve.mc...@gmail.com on 23 Dec 2009 at 2:41

GoogleCodeExporter commented 8 years ago
Here's a file showing the pot size turned to 2-color, and zoomed in. Matching 
this may 
not be too difficult.

Original comment by steve.mc...@gmail.com on 23 Dec 2009 at 2:45

GoogleCodeExporter commented 8 years ago

Original comment by steve.mc...@gmail.com on 23 Dec 2009 at 2:45

Attachments:

GoogleCodeExporter commented 8 years ago
You know, the more I play with this, the more that I think I can make it work 
with
the scraping and OCR, but I'm going to have to do some work on the initial image
grab.  I've realized that the initial image I write to disk to manipulate is 
very
fuzzy compared to screen shots grabbed with the screen capture tool built into 
OS X,
and I need to figure out why that is.  

By way of reference, the reason I like the scraping + OCR approach over the 
pixel
matching approach is the flexibility;  doing pixel matching would require 
setting it
up for every theme and for every character, which would require a lot of work.  
If I
can make this approach work about 20% better, it should work on most themes 
with no
extra effort (as long as the screen coordinates are properly specified per 
theme). 
But if I can't make it work this way, I'll rip out the guts and resort to pixel
matching.  

Original comment by steven.h...@gmail.com on 4 Jan 2010 at 11:45

GoogleCodeExporter commented 8 years ago
I've committed changes to make the image code perform a lot more like Steve's 
example
above.  My informal tests suggest that PSB reliability has correspondingly 
improved
at all sizes, especially the smallest ones.  I'm still working on a transient 
bug
with convert, but I'm much happier with the overall process.  Anyone who wants 
to
check out the branch (psbBranch) and test it out is welcome to. Otherwise, once 
I've
worked out the problem with convert, I'll fold the changes into the trunk.

Original comment by steven.h...@gmail.com on 5 Jan 2010 at 9:02

GoogleCodeExporter commented 8 years ago
Okay, I added a new version of the ImageMagick commmand line tool convert, which
seems to have solved the transient bug I was having, and folded the changes 
from the
branch into the trunk.  Testing is still required, but it worked enough during 
my 2+
hr. playing session last night that I'm going to release it, because I think the
improvement is important enough that people will want it. :-)  Please report 
any issues!

Original comment by steven.h...@gmail.com on 5 Jan 2010 at 9:50

GoogleCodeExporter commented 8 years ago
So far so good. I've been playing for the last couple hours with anywhere from 
1-10 tables up and haven't had any 
problems with the pot betting feature. I'm using Pokerstars black theme. 

Original comment by amar...@gmail.com on 6 Jan 2010 at 1:42

GoogleCodeExporter commented 8 years ago
Sweet!  Maybe I've finally gotten this right, and can move on to adding new 
features...

Original comment by steven.h...@gmail.com on 6 Jan 2010 at 2:45

GoogleCodeExporter commented 8 years ago
This has been working well for me for a while now and no-one is reporting bugs, 
so
I'm going to close this issue and address specific problems with PSB as they 
arise.

Original comment by steven.h...@gmail.com on 10 Jan 2010 at 5:24

GoogleCodeExporter commented 8 years ago
Although this is a feature I rarely use, seems to be working well when I do 
over the
last 80-100 SNG's.

Original comment by vyo...@gmail.com on 11 Jan 2010 at 8:27