Poker-AI.org

Poker AI and Botting Discussion Forum
It is currently Mon Nov 13, 2023 6:51 pm

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Wed Mar 20, 2013 7:57 pm 
Offline
Junior Member

Joined: Fri Mar 15, 2013 11:55 am
Posts: 24
Hello.

I'm currently using pixel recognition with only very little OCR to read the screen. For the OCR, I use WinAPI to get a screen shot into memory. This allows me to get 80-120 pictures of the screen per second, but it uses a lot of resources I would like to free up for other parts of the application.

Is there any way to do this more efficiently, i.e. by accessing the graphics card memory directly? I do have some OpenGL programming experience, so I wouldn't shy back from some lower level stuff, as long as it pays off.


Top
 Profile  
 
PostPosted: Thu Mar 21, 2013 12:12 am 
Offline
Junior Member
User avatar

Joined: Mon Mar 11, 2013 6:22 pm
Posts: 13
Yes, you can get better results with OpenGL. Google around if you have to. But you don't really need to do that. Because couple of frames per second is more than enough. Just keep polling few pixels to give a better response time for your bot/scraper and scrape the rest when it's really needed. If you're in hand, you can't really miss anything. When observing even 120fps will not guarantee you won't miss anything. Causes more stalls, if nothing else. It's a good amount of data to move around.


Top
 Profile  
 
PostPosted: Thu Mar 21, 2013 10:08 am 
Offline
Junior Member

Joined: Fri Mar 15, 2013 11:55 am
Posts: 24
Kratt wrote:
Yes, you can get better results with OpenGL. Google around if you have to. But you don't really need to do that. Because couple of frames per second is more than enough. Just keep polling few pixels to give a better response time for your bot/scraper and scrape the rest when it's really needed. If you're in hand, you can't really miss anything. When observing even 120fps will not guarantee you won't miss anything. Causes more stalls, if nothing else. It's a good amount of data to move around.


I don't think you can use OpenGL if there's no OpenGL app running?

Of course, I won't be polling 120 times per second, that's just meant as a measure of performance. I just want to reduce the resources used by each poll to the minimum so I can use them for something more important.


Top
 Profile  
 
PostPosted: Fri Mar 22, 2013 3:56 pm 
Offline
Site Admin
User avatar

Joined: Thu Feb 28, 2013 5:24 pm
Posts: 230
Heuristics wrote:
I just want to reduce the resources used by each poll to the minimum so I can use them for something more important.

Then focus on more important (smaller) parts of the picture, as Kratt suggested. No need to take a screenshot of the whole screen if you are just trying to watch one table. No need to capture the whole table if you are just polling if the dealer button moved, etc.

_________________
Cheers.


Top
 Profile  
 
PostPosted: Fri Mar 22, 2013 4:09 pm 
Offline
Junior Member

Joined: Fri Mar 15, 2013 11:55 am
Posts: 24
Coffee4tw wrote:
Heuristics wrote:
I just want to reduce the resources used by each poll to the minimum so I can use them for something more important.

Then focus on more important (smaller) parts of the picture, as Kratt suggested. No need to take a screenshot of the whole screen if you are just trying to watch one table. No need to capture the whole table if you are just polling if the dealer button moved, etc.


That's not the point of this thread. I am currently using single pixel polling for all of those things.

I however ALSO want to have a way of accessing the WHOLE screen directly in the video memory in an EFFICIENT way - meaning NOT through WinAPI.

Why? Because in case the software changes graphics or moves buttons, etc. by a some pixel value, I can switch to an OCR & Computer Vision engine while rebuilding the pixel values.


Top
 Profile  
 
PostPosted: Fri Mar 22, 2013 4:59 pm 
Offline
Junior Member
User avatar

Joined: Mon Mar 11, 2013 6:22 pm
Posts: 13
Then "I/we don't know" would be the direct answer to your question, without suggesting any alternatives. Because that's not the point of this forum, I would say. A single Google search will give you the fastest screen capturing methods available. This is a really common problem/question for various applications all around and way more critical than you "fallback" requires. Try to be practical. Start thinking about universal things like that when you've got nothing else to do anymore. Even when taking fullscreen captures, you don't need any more frames per second. OCR and fancy CV will be the bottlenecks then rather than capturing. I sincerely doubt that you have or ever will have the optimal efficiency going on in that part. Your simplest solution should be able to handle smaller shifts. If the bigger graphics changes are too much of a manual labor for you, build a tool to help you along or something.


Top
 Profile  
 
PostPosted: Fri Mar 22, 2013 7:19 pm 
Offline
Site Admin
User avatar

Joined: Thu Feb 28, 2013 5:24 pm
Posts: 230
Heuristics wrote:
That's not the point of this thread. I am currently using single pixel polling for all of those things.
I however ALSO want to have a way of accessing the WHOLE screen directly in the video memory in an EFFICIENT way - meaning NOT through WinAPI.

We used to have a couple hardware/low-level cracks on the old forum, not sure if they joined/are going to join again. You may want to search through the archive, I think there were some pretty useful discussions related to this topic on there.

_________________
Cheers.


Top
 Profile  
 
PostPosted: Fri Mar 22, 2013 8:37 pm 
Offline
Junior Member

Joined: Fri Mar 15, 2013 11:55 am
Posts: 24
Kratt wrote:
A single Google search will give you the fastest screen capturing methods available.


You have obviously *not* done that Google search ;).

I appreciate the thought, but there are very different people on this forum, for very different reasons. Computer Vision, Visual Processing and OCR are definitely a big part of many bot programs.

Simple things as detecting new positions or buttons are not that complicated or performance intensive. More importantly, the performance gains you can achieve by fine tuning it are usually small percentages.

Accessing the video memory directly - through a driver for instance - should however increase the performance of that part of the program by several factors. It's thus a much more sensible choice to look into.

So, as much as I appreciate your advice, I do believe there is a place for this kind of question here, and I do hope that some of the hardware/low-level cracks will get a chance to give me some guidance.


Top
 Profile  
 
PostPosted: Fri Mar 22, 2013 10:13 pm 
Offline
Junior Member
User avatar

Joined: Mon Mar 11, 2013 6:22 pm
Posts: 13
Good point.

Don't forget to update when you find the way.


Top
 Profile  
 
PostPosted: Fri Mar 22, 2013 11:12 pm 
Offline
Senior Member

Joined: Mon Mar 11, 2013 10:24 pm
Posts: 216
I don't have any experience with the topic, but maybe open source virtualization tools like XEN might be worth looking into it - I can imagine they have a kind of abstraction layer that might be accessible.


Top
 Profile  
 
PostPosted: Sat Mar 23, 2013 7:03 am 
Offline
Veteran Member

Joined: Thu Feb 28, 2013 2:39 am
Posts: 437
This might be useful:
http://stackoverflow.com/questions/1962 ... pplication


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group