ald4r1s Posted May 16, 2010 Share Posted May 16, 2010 Hello,I've got a huge problem with AutoITI want to make a simple program for popular "Pairs" game, where you have to match 2 or more same pictures above the variety of them.This script is ment to get pixels from bottom picture, and find it at the top by marking it.Here's the example screenshot of PairsMy method:Get half pixels(rectangular) from each bottom image, and match them with top pictures.Sounds nice, but...pictures at top are like 2,5 times smaller than those in bottom.Any ideas how to?Maybe some special autoit commands?Thanks in advanceBtw. sorry for my english Link to comment Share on other sites More sharing options...
Fainth Posted May 16, 2010 Share Posted May 16, 2010 (edited) One Method wouldbe picking like 5 points out of the lower picture like O..................O ..........O O..................O and readout the colors. then do a pixelsearch in all of the above minipictures and give it a small threshold for variance. you would have to check on the coordinates similar to the dots in your lower pictures. like cutting the pictures apart and go over one by one. the picture looks static so that should be a cake job. The runtime wont matter that much i guess as its not time critcal? Edited May 16, 2010 by Fainth Link to comment Share on other sites More sharing options...
ald4r1s Posted May 16, 2010 Author Share Posted May 16, 2010 This 5 points method sounds really nice and convenient The thing is that runtime is crucial... Link to comment Share on other sites More sharing options...
Fainth Posted May 16, 2010 Share Posted May 16, 2010 Well then your routine should be quick enough, if you go by the point-for-point to eval if it 'could' be the target picture,you should be quick enough. say your lower pic is 200x200 and your upper left point is 20,20 (say 10%) then on a 100x100 target that would upper left 10,10 in relative coordiantes. 20,20 180,20 100,100 180,180 20,180 in your target 10,10 90,10 50,50 90,90 10,90 points to check for 'about' similar colors. if you get 100% hit, there is your pic, anything below is a fail. you may want to play around with the threshold in pixelsearch. Link to comment Share on other sites More sharing options...
ald4r1s Posted May 16, 2010 Author Share Posted May 16, 2010 (edited) Hm, what do you think about marking rectangle from the left of botom picture to it's half like: O......|......O .........|......... O......|......O Next step would be finding the same part minimized to the scale of top area pictures. In other words, the bottom picture after getting pixels gets minimized to the size of top pictures. Is that possible? Edited May 16, 2010 by ald4r1s Link to comment Share on other sites More sharing options...
Fainth Posted May 16, 2010 Share Posted May 16, 2010 Thats alot more effort than you need. the Points-Compare should do good enough unless you have alot of very similar pictures. If you realy try to calculate the image down to smaller size for comparison that kills your runtime for sure. Link to comment Share on other sites More sharing options...
ald4r1s Posted May 16, 2010 Author Share Posted May 16, 2010 The pictures from top are reduced by 40%. To be honest, i've always used autoit to create simple scripts using keyboard/mouse. How should i properly use pixelsearch in this case? 5 pixel coords of first big picture, however - i'm not quite sure if using variables is proper. $1= PixelGetColor( 20, 520) $2= PixelGetColor( 20, 580) $3= PixelGetColor( 80, 520) $4= PixelGetColor( 80, 580) $5= PixelGetColor( 50, 555) Script should be based on PixelGetColor and PixelSearch, right? Would be nice to get some advices since i can't deal with it by myself. Link to comment Share on other sites More sharing options...
Fainth Posted May 16, 2010 Share Posted May 16, 2010 A start would be using the au3info tool, from the tools bar in scite. you can determine and write down the coordinates of the pictures. Link to comment Share on other sites More sharing options...
ald4r1s Posted May 17, 2010 Author Share Posted May 17, 2010 And that's what i did - those values from my last post in () are actually the coordinates from window info. Link to comment Share on other sites More sharing options...
ald4r1s Posted May 20, 2010 Author Share Posted May 20, 2010 any help can be provided? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now