forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


image recognition

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
suxi
Newbie


Joined: 16 Jan 2005
Posts: 23

PostPosted: Mon Jan 17, 2005 11:01 am    Post subject: image recognition Reply with quote

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
View user's profile Send private message
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 480
Location: California

PostPosted: Mon Jan 17, 2005 3:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
suxi
Newbie


Joined: 16 Jan 2005
Posts: 23

PostPosted: Mon Jan 17, 2005 4:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Jan 18, 2005 5:24 pm    Post subject: Reply with quote

...
VDSug.dll has a "getpixel" function that should allow you to do
this directly from the screen. Wink

There's a link in my sig.

Cheers, Mac Smile

_________________
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
View user's profile Send private message Send e-mail
suxi
Newbie


Joined: 16 Jan 2005
Posts: 23

PostPosted: Thu Jan 20, 2005 4:40 pm    Post subject: Reply with quote

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 Very Happy .

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
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Thu Jan 20, 2005 8:02 pm    Post subject: Reply with quote

You are quite welcome, glad ya found it useful. Smile

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. Wink

Cheers, Mac Smile

[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). Embarassed

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
View user's profile Send private message Send e-mail
suxi
Newbie


Joined: 16 Jan 2005
Posts: 23

PostPosted: Fri Jan 21, 2005 9:16 am    Post subject: Reply with quote

Thank you very much!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group