Re: Find an image on screen
What exactly are you trying to accomplish?
When you say on the screen are you saying if it appears anywhere? Like as in any application "Word, Excel, IE, Wordpad etc" or one specific application you are monitoring. Or is just your own application you are trying to check images?
Re: Find an image on screen
Quote:
Originally Posted by
tylerpestell
What exactly are you trying to accomplish?
When you say on the screen are you saying if it appears anywhere? Like as in any application "Word, Excel, IE, Wordpad etc" or one specific application you are monitoring. Or is just your own application you are trying to check images?
Basically, if the image is shown. So lets say I took a screenshot of my whole screen. it would search that screenshot to see if there is a certain image in it.
Like lets say I have a bunch of programs open, and there is some shape it needs to find, it would look to see if that shape is on the screen itself, not specifically in applications, but if that pixel combination is on the screen.
Re: Find an image on screen
How fast you need this to be? for example an aimbot should be almost real time, you need something this fast or some seconds would still be ok?
Re: Find an image on screen
Quote:
Originally Posted by
jcis
How fast you need this to be? for example an aimbot should be almost real time, you need something this fast or some seconds would still be ok?
A few seconds would be fine. However, I would really appreciate it if you would show me how to do this in both cases.
Thanks.
Re: Find an image on screen
For finding a simple picture (2D) i would just mark some representative pixels, say 8 pixels and store their position, then when i find those 8 pixels in the correct position on the screen (given an x/y offset) i know i found the picture, this will be faster because you have for example 8 pixels, not all of them. Then for example you scan the desktop image looking for the 1st pixel, if found then go to 2nd pixel coordinates and check there, then the 3rd pixel, and you keep like this until all 8 pixels has been found, then you can say you found your image. Maybe 3 or 4 pixels could also be enough.
Now, if you need to work on a 3D world, like 1st person shooter games then things will be much harder, the best for aimbots is finding a pixel, because a pixel is always a pixel, a picture (like the enemy's head for example) will depend on distance, this is the big problem, if the enemy is closer the picture is bigger otherwise it's smaller, finding a picture at any distance will be almost impossible (I think).
Re: Find an image on screen
For 2D, some steps:
1) Determine your representative pixels, store color, x pos and y pos for each and store them somewhere, an array for example.
2) Take an screenshot as bitmap using something like this
3) Use Fastpix (submitted by boops boops to the Codebank) for fast pixel processing. With this you'll create a loop checking each pixel in the screenshot bitmap, when you find the first see if the second is also in position and so on, if you find all of them then you found your bitmap, if not then continue looping.
Assume your 1st representative pixel is at X=40+xOffset and Y=20+YOffset, then you know that moving 40 towards LEFT and 20 towards TOP you'll find the first point (top-left corner) for your image found in the screen, and if you need the center it will be:
X = X0 + YourImageWidth / 2
Y = Y0 + YourImageHeight / 2
Re: Find an image on screen
Quote:
Originally Posted by
jcis
For 2D, some steps:
1) Determine your representative pixels, store color, x pos and y pos for each somewhere, an array for example.
2) Take an screenshot as bitmap using something like
this
3) Use
Fastpix (submitted by boops boops to the Codebank) for fast pixel processing. With this you'll create a loop checking each pixel in the screenshot bitmap, when you find the first see if the second is also in position and so on, if you find all of them then you found your bitmap, if not then continue looping.
Assume your 1st representative pixel is at X=40 / Y=20, then you know that moving 40 towards LEFT and 20 towards TOP you'll find the first point (top-left corner) for your image found in the screen, and if you need the center it will be:
X = X pos + YourImageWidth / 2
Y = Y pos + YourImageHeight / 2
But how can I check (for step 1) what are the pixel colors for certain coordinates.
Re: Find an image on screen
Quote:
Originally Posted by
yoni201
But how can I check (for step 1) what are the pixel colors for certain coordinates.
I gave you the code to do that in this post in another thread and you said it didn't work for you. Maybe that code doesn't work in vs2008 express? i'm using vs2010
Re: Find an image on screen
Quote:
Originally Posted by
jcis
I gave you the code to do that in this
post in another thread and you said it didn't work for you. Maybe that code doesn't work in vs2008 express? i'm using vs2010
Yeah that didn't work for me...
Could you maybe send me the EXE program?
basically you put an image into a picturebox and once you click a button it puts the RGB values of the pixels of all the coordinates into a listbox.
Thanks man.
Re: Find an image on screen
No, you can't ask for compiled code every time something doesn't work, you need to make it work yourself. Search on google, search the forums, you have many tools at your dispossal to help you understand why those 3 lines of code are not working for you. Step 1 is the easier one.