| View previous topic :: View next topic |
| Author |
Message |
suxi Newbie
Joined: 16 Jan 2005 Posts: 23
|
Posted: Mon Jan 17, 2005 11:01 am Post subject: image recognition |
|
|
Hello everyone
I would like to write a poker game analysing utility and need to implement an image recognition routine in order to read out my cards form the game window.
I can think of two ways to achieve this:
1) read out the colour information of single pixels on the screen. This way I could simply define unique pixels on the playing window for each particular card. I think this would be the easiest way, but it requires the use of an external DLL which can read out single pixels and return the rgb values. Does anyone know of such a DLL or is maybe even able to make one up?
2) Capture a particular screen area and save it to disk. Load this file into VDS and compare it with predefined pattern files. I have found a working screen capture dll, but have problems working with the resulting image file within VDS. I tried to simply load the bmp as text into a list, but VDS doesn’t want to do it. I think it has problems with strange ascii values. Is there a way to load a bmp as a string or binary file into vds and to do string operations on it?
Thank you very much for any help on this subject. If you can think of totally different ways, please let me know, too.
All the best from Hamburg
Marc |
|
| Back to top |
|
 |
Hooligan VDS Developer


Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Mon Jan 17, 2005 3:43 pm Post subject: |
|
|
Sounds like a monumental task... But interesting!
Using method 2, try loading as a binfile, [@binfile()].
Then you're working with numeric values.
Hooligan _________________ Hooligan
Why be normal? |
|
| Back to top |
|
 |
suxi Newbie
Joined: 16 Jan 2005 Posts: 23
|
Posted: Mon Jan 17, 2005 4:00 pm Post subject: |
|
|
BINFILE, that's the one I was hoping for!
Thank you sooo much! Why didn't I see this command myself? I am sure I searched the VDS help for Binary. Well, must be the age <g>.
I'll let you all know how it goes.
All the best
Marc
PS: A read pixel colour DLL would still be highly appreciated |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Tue Jan 18, 2005 5:24 pm Post subject: |
|
|
...
VDSug.dll has a "getpixel" function that should allow you to do
this directly from the screen.
There's a link in my sig.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
suxi Newbie
Joined: 16 Jan 2005 Posts: 23
|
Posted: Thu Jan 20, 2005 4:40 pm Post subject: |
|
|
Mac, you are my hero and you safed my day! I just happily deleted lines and lines of useless code trying to write my image recognition routine. With VDSug.dll this will be a peace of cake.
I am over the moon .
Thank you very much and all the best
Marc
PS: Why does the get pixel command require a window handle and why doesn't it work, if I get that handle wrong? Doesn't it capture absolute pixels from the screen?
Thanks for any comments. |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Jan 20, 2005 8:02 pm Post subject: |
|
|
You are quite welcome, glad ya found it useful.
Actually getpixel doesn't require a window handle.
A window handle is only required for the drawing
functions (where the DLL must create a DC to work
with), so it can draw to the proper window.
Cheers, Mac
[EDIT]
OOPS - yes it does require a handle, as it also uses a DC to get the
pixel. Sorry, I thought ya meant when loading the DLL (lol, and I
hadn't looked at the code or used GETPIXEL in a while either).
You can use @winatpoint(x,y) to get the handle though - here's an
example of getting a pixel using the mouse position:
| Code: |
%%pixel = @ug(GETPIXEL, @winatpoint(@mousepos(X),@mousepos(Y)), @mousepos(X),@mousepos(Y))
|
_________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
suxi Newbie
Joined: 16 Jan 2005 Posts: 23
|
Posted: Fri Jan 21, 2005 9:16 am Post subject: |
|
|
| Thank you very much! |
|
| Back to top |
|
 |
|