Sign in to follow this  
Followers 0
ald4r1s

Pixelsearch problem

10 posts in this topic

Hello,

I've got a huge problem with AutoIT

I 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 Pairs

Posted Image

My 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 advance

Btw. sorry for my english :idea:

Share this post


Link to post
Share on other sites

#2 ·  Posted (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 by Fainth

Share this post


Link to post
Share on other sites

This 5 points method sounds really nice and convenient

The thing is that runtime is crucial...

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by ald4r1s

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

And that's what i did - those values from my last post in () are actually the coordinates from window info.

Share this post


Link to post
Share on other sites

any help can be provided?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0