Lets say I want to create a script that will identify when an image in a game comes up and then do a specific action depending on the image. I'm trying to figure out how to do this? Any ideas?
|
Python
Image recognition? |
|
Aug 11, 2020 01:32 AM
(This post was last modified: Aug 11, 2020 01:32 AM by Bastille.)
Is it a specific image or images could be different ? Like :
- When a red circle appears on the screen, your mouse auto click somewhere or - When a dog appears (could be different images of dogs, so need IA), your mouse auto click somewhere
Aug 11, 2020 02:06 AM
(This post was last modified: Aug 11, 2020 02:07 AM by Crypt.)
(Aug 11, 2020 01:32 AM)Bastille Wrote: Is it a specific image or images could be different ? Like : It's actually 4 images that never change. So it has one image above them and then makes you click the correct image below.
It's difficult to know without seeing the images.
However there is a similar project below which may help give you some direction. https://github.com/imneonizer/Chrome-dino-game-bot (Aug 11, 2020 12:26 PM)tux1 Wrote: It's difficult to know without seeing the images. If I need some help do you mind if I message you? I can send a photo of the images and go into more detail. (Aug 11, 2020 12:46 PM)Crypt Wrote: If I need some help do you mind if I message you? I can send a photo of the images and go into more detail. Image recognition isn't my strong point but yes feel free to msg me, I maybe able to point you in the right direction (Aug 11, 2020 05:08 PM)Lindros Wrote: Maybe you can iterate through the RGB values of the image, average them out and see if the value is the same? I'd assume something like that would be different for each image. That's just my guess. Here just so we are on the same page. It's for a Runescape server. So it will show you an image like this: https://imgur.com/mSGghN8 Then you have to click the correct image below: https://imgur.com/dkA8Hzw (Aug 11, 2020 05:12 PM)Crypt Wrote: Here just so we are on the same page. It's for a Runescape server. Do you have access to the actual image file, like could you download it or would you have to screen cap it or something? ![]() (Aug 11, 2020 05:13 PM)Lindros Wrote: Do you have access to the actual image file, like could you download it or would you have to screen cap it or something? I would have to probably take screenshots and then use the images that way.
Aug 11, 2020 05:19 PM
(This post was last modified: Aug 11, 2020 05:26 PM by Lindros.)
(Aug 11, 2020 05:14 PM)Crypt Wrote: I would have to probably take screenshots and then use the images that way. Well if you could consistently grab the exact same area, depending on the image format there are libraries I think that you can iterate through the rgb pixel values. I've done stuff like that for school for black and white colorization of images. I'm not too sure honestly. Maybe look into screen capping specific pixel ranges, than you at least know box 1, 2 or 3 is in each range. Then you can be grabbing the same exact amount of pixels for each box each time. Then you can maybe see if you can analyze the values. Does that make sense? I feel like you would absolutely need to get the exact same image/amount of pixels every time for this method to work. Honestly i'm really guessing on this, I don't know much about image recognition. That's generally a machine learning technique that is beyond my current level of knowledge. UPDATE: What you are looking for is a image classifier. Look into that. You train it by giving it a folder of the images. It shouldn't be too difficult. I talked to a person I know who knows about machine learning. Try following some tutorials on that. https://www.pyimagesearch.com/2014/09/15...wo-images/ ![]()
Aug 11, 2020 05:30 PM
(This post was last modified: Aug 11, 2020 05:34 PM by Crypt.)
(Aug 11, 2020 05:19 PM)Lindros Wrote: Well if you could consistently grab the exact same area, depending on the image format there are libraries I think that you can iterate through the rgb pixel values. I've done stuff like that for school for black and white colorization of images. Yeah, I could maybe download all the possible images and somehow sort through them to find the best match? Also the pixel idea probably won't work because look at this image: https://imgur.com/mSGghN8 They add in those specs of random pixels to through off a possible bot. Which makes it harder. This is honestly why I chose this program because I knew I'd have to do a lot of research and testing. This would also probably be a lot easier to do in Java, considering the game is coded in Java and I could use NPC/object Id's. I want to use Python tho :( (Aug 11, 2020 05:30 PM)Crypt Wrote: Yeah, I could maybe download all the possible images and somehow sort through them to find the best match? Are the pixels they add in, in random places every single time? That seems like a problem for any kind of image recognition. Sorry man don't know too much about it. ![]() (Aug 11, 2020 05:35 PM)Lindros Wrote: Are the pixels they add in, in random places every single time? Yeah, most likely every image the pixels will be in a different spot. However with the link you sent it may not be an issue? It can still look for specific pixel placement? For example different colors or shades of black. I also run into the issue I need the script to recognize when the NPC shows up and to click to talk to him. I should probably just give up on doing this in Python, it might not make sense to do it in Python. (Aug 11, 2020 05:42 PM)Crypt Wrote: Yeah, most likely every image the pixels will be in a different spot. No honestly, if you can do image recognition in any language, Python is the language. Python is probably the number one language for machine learning. You definitely want to train a neural network of some kind to try to categorize the images. ![]() |
|
|





![[Image: FtwuQgr.gif]](https://i.imgur.com/FtwuQgr.gif)
![[Image: Iu0EfTL.gif]](https://i.imgur.com/Iu0EfTL.gif)