| View previous topic :: View next topic |
| Author |
Message |
Bizarro I post too much
Reputation: 0
Joined: 01 May 2007 Posts: 2648
|
Posted: Mon Jun 16, 2008 4:00 pm Post subject: [c++]how to detect image from screen |
|
|
i was wondering if its possible to
detect a small image when it appares on the screen
using c++.
lets say i have copied a dog image(30x30 pixel). i want to detect that same image when it reappears on the screen and make a beep.
any idea?
_________________
w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils |
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Mon Jun 16, 2008 4:15 pm Post subject: |
|
|
Unless there's some API that I don't know about, you'd probably have to loop through the screen and compare the pixels you got from there to your image.
It'd probably be a pretty slow process.
_________________
|
|
| Back to top |
|
 |
Chaosis13 Master Cheater
Reputation: 0
Joined: 14 Aug 2007 Posts: 372
|
Posted: Mon Jun 16, 2008 4:20 pm Post subject: |
|
|
Using Auto Hotkeys might be easier, unless it if for your trainer....
Then I would make an array and add the bytes of each pixle into it. Then I would take an array the same way of the screen, then compare them for a similar section. Then have it retreave the upper most sections position.
Or you could search for 3 or 4 distinctive pixles to improve the speed...
_____________________________________________________________
I have no experience with this, just saying how I would go about doing it...
|
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Mon Jun 16, 2008 4:27 pm Post subject: Re: [c++]how to detect image from screen |
|
|
| Bizarro wrote: | i was wondering if its possible to
detect a small image when it appares on the screen
using c++.
lets say i have copied a dog image(30x30 pixel). i want to detect that same image when it reappears on the screen and make a beep.
any idea? |
Nope...unless u do what samuri25404 said....
Does this by any chance, detect the position of a monster?
If so I tried to do that already....and it is hard XD
|
|
| Back to top |
|
 |
Bizarro I post too much
Reputation: 0
Joined: 01 May 2007 Posts: 2648
|
Posted: Mon Jun 16, 2008 4:30 pm Post subject: |
|
|
same here i havent done this before.
the only method i can think of is using pixel detection
get 3-4 pixel points of that image with pre-defined x/y difference. then scan the whole screen every 2-3 sec.
but in my opinion, thats not a very efficient way of coding....
_________________
w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Jun 16, 2008 5:40 pm Post subject: |
|
|
Set/GetPixel are SLOW.
Look into using bitmaps, it will be MUCH faster.
|
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Mon Jun 16, 2008 6:50 pm Post subject: |
|
|
| Bizarro wrote: | same here i havent done this before.
the only method i can think of is using pixel detection
get 3-4 pixel points of that image with pre-defined x/y difference. then scan the whole screen every 2-3 sec.
but in my opinion, thats not a very efficient way of coding.... |
I tried this with ACTools and it took like 20 seconds per scan lol...but this was like 15 versions ago.
If you are trying to detect the position of monsters, maybe I can help you in other areas of coding?
|
|
| Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Mon Jun 16, 2008 7:19 pm Post subject: |
|
|
Start at the corner of the screen and start looking for the first pixel of the image you're searching for. If they match, check the next pixel on the screen for the next pixel in the image and so on. If they don't match, check the next pixel for the first pixel of the image.
_________________
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Mon Jun 16, 2008 7:37 pm Post subject: |
|
|
I'd say look into actually hacking the game.
Find the collection of mob structures, and what not.
You'll probably earn a decent amount of respect if you don't get spoonfed that. :wink:
_________________
|
|
| Back to top |
|
 |
Bizarro I post too much
Reputation: 0
Joined: 01 May 2007 Posts: 2648
|
Posted: Mon Jun 16, 2008 8:44 pm Post subject: |
|
|
why would i detect mob using pixel... thats just simply stupid...
considerinng how many monsters in a map.
im detecting something uncommon but yet important
| slovach wrote: | Set/GetPixel are SLOW.
Look into using bitmaps, it will be MUCH faster. |
do u have any idea any api for this?
_________________
w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils |
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Mon Jun 16, 2008 10:16 pm Post subject: |
|
|
| Bizarro wrote: | why would i detect mob using pixel... thats just simply stupid...
considerinng how many monsters in a map. |
Then get it from the memory.
Anything in the graphics can be found in the memory much more efficiently.
_________________
|
|
| Back to top |
|
 |
--Pillboi-- Grandmaster Cheater Supreme
Reputation: 0
Joined: 06 Mar 2007 Posts: 1383 Location: I don't understand the question. Is this a 1 to 10 thing?
|
Posted: Tue Jun 17, 2008 11:03 am Post subject: |
|
|
| samuri25404 wrote: | | It'd probably be a pretty slow process. |
Or a high one with a high cpu usage. For example, you could speed the process up by 4 times, by using 4 threads, each one scanning a quarter of the screen over and over. However, you could use multiple threads like stated above if you don't mind your program raping people's cpu.
_________________
Enter darkness, leave the light, Here be nightmare, here be fright...
Earth and Water, Fire and Air. Prepare to meet a creature rare.
Enter now if you dare, Enter now the dragon's lair. |
|
| Back to top |
|
 |
Bizarro I post too much
Reputation: 0
Joined: 01 May 2007 Posts: 2648
|
Posted: Wed Jun 18, 2008 10:45 am Post subject: |
|
|
| --Pillboi-- wrote: | | samuri25404 wrote: | | It'd probably be a pretty slow process. |
Or a high one with a high cpu usage. For example, you could speed the process up by 4 times, by using 4 threads, each one scanning a quarter of the screen over and over. However, you could use multiple threads like stated above if you don't mind your program raping people's cpu. |
hehe thats a good idea:P
i just heard ppl actually selling this program (in a USB) for money.
you specify which image u want to detect. if it appears on screen, alarm will sound
_________________
w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils |
|
| Back to top |
|
 |
--Pillboi-- Grandmaster Cheater Supreme
Reputation: 0
Joined: 06 Mar 2007 Posts: 1383 Location: I don't understand the question. Is this a 1 to 10 thing?
|
Posted: Wed Jun 18, 2008 11:43 am Post subject: |
|
|
Well, there you go then. You could let the user set the accuracy, which would be how many pixels to go right each loop, using a slider.
_________________
Enter darkness, leave the light, Here be nightmare, here be fright...
Earth and Water, Fire and Air. Prepare to meet a creature rare.
Enter now if you dare, Enter now the dragon's lair. |
|
| Back to top |
|
 |
Cx Master Cheater
Reputation: 0
Joined: 27 Jul 2007 Posts: 367
|
Posted: Wed Jun 18, 2008 10:44 pm Post subject: |
|
|
| Bizarro wrote: | | --Pillboi-- wrote: | | samuri25404 wrote: | | It'd probably be a pretty slow process. |
Or a high one with a high cpu usage. For example, you could speed the process up by 4 times, by using 4 threads, each one scanning a quarter of the screen over and over. However, you could use multiple threads like stated above if you don't mind your program raping people's cpu. |
hehe thats a good idea:P |
No it's not. >__>
| --Pillboi-- wrote: |
a high cpu usage. |
_________________
armed with this small butterfly net
i will face the world alone
& never be lonely. |
|
| Back to top |
|
 |
|