NoobInGA Posted June 13, 2005 Report Share Posted June 13, 2005 I am looking for a way to search the active Window for a Specific Pixel Patern. Once that Pixel Patern is found I would like to copy the location to a Variable. Any ideas on how to do this. Quote Link to comment Share on other sites More sharing options...
Cory Posted June 13, 2005 Report Share Posted June 13, 2005 You should be able to just read the pixels colors with the "Get Pixel Color" and when the appropriate pattern is matched the variable you used to get the match is your location. My answer seems to obvious to me so I reckon I must be missing something. Maybe you could give me a littel more info to work with. Quote Link to comment Share on other sites More sharing options...
NoobInGA Posted June 14, 2005 Author Report Share Posted June 14, 2005 Hi Cory and thanks for the response. I was a Little short on information on this one. Here is what I am looking for. I am searching an Image basically for a String of Letters. The Get Pixel Idea would certainly work but it would be a quit a long and intricate process to search the entire screen for this particular patern. The Images that are being Searched are 1024X768. The Patern would be probably 4 Characters long and each Character would probably be 6 X 5 Pixels in size with a 2 Pixel width spacer in beteen each character. The Pixels would be grey on black I believe. That being said I would be searching for a specific patern that would be 30 Pixels wide and 5 Pixels in Width. The Issue with it comes in the fact that this 30X5 Section of pixels that I am looking for could be anywhere on the screen or it may not even exist. I was hoping for the lazy mans way out of a Function that would do a Picture match. I could do the picture match in VB but was hoping for an easy way to just put it into a macro. Hope the more information helps. NoobInGA Quote Link to comment Share on other sites More sharing options...
Cory Posted June 14, 2005 Report Share Posted June 14, 2005 From what I've read here many have tried similar things with ME. It’s an interesting problem but it should be fairly simple in logic but complex (or maybe just alrge) in implementation. I wish I had an example because there may be another way. For instance you could save the graphic and use something like IrfanView to get characteristic info. Or saving it as a BMP to get a file size. Another thing you might consider is scanning the entire image with pixel color and creating some sort of checksum. Let’s say we have white on black pixels. If you needed to distinguish between two graphics one with the word “Yes” and the other with the word “No” the count of black pixels would be different. Stuff like that. In the worst case it should be simple to create a pixel list in an text file or in the registry that would be the fingerprint for the 30X5 character. Then simply create a routine that starts at pixel 1,1 and scans over 5 30 times down. As soon as it doesn’t match the pixel list it bails and moves on to 1,2. But I don’t know how fast ME is at executing these commands and how quickly you need a response so it might not be the best tool. You might try saving the graphic file and searching for a matching hexadecimal string too. Just a thought. Quote Link to comment Share on other sites More sharing options...
NoobInGA Posted June 14, 2005 Author Report Share Posted June 14, 2005 I think I will give it a run tonight at doing the screen scan on a Pixel by Pixel Scan and see what I come out with. That may be the easiest thing to do. In looking closely at the pictures I may be able to draw some soft of patterns in where I should look for the words. I will post an example here with what I come up with. NoobInGa Quote Link to comment Share on other sites More sharing options...
randallc Posted June 14, 2005 Report Share Posted June 14, 2005 Hi, 1. If you have a vbs script already, it may be easier to run that from ME and send the answer back to ME via an ini file, registry entry, text file or similar (see Floyd's examples) 2. Others have got this sort of thing going, I think; but I have not used either; pixels You might ask "ol3ears" about his - (from that other linked thread)? Best, Randall EDIT - fixed reference link Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.