Jump to content
Sign in to follow this  
SpaceNinja

How to speed up pixelgetcolor()

Recommended Posts

SpaceNinja

I have a fairly sophisticated script that requires some pattern detection on the user's screen. My problem is that I seem to be running into a bottleneck when using pixelgetcolor() to grab pixel values. I am grabbing about 62 pixels at a time and it takes about 2-3 seconds to collect them all and I'd really like to grab ~2-5 times that many in the same amount of time. Does anyone have any suggestions on how to do this faster?

I was thinking about maybe using printscreen to copy an image to the clipboard then scanning the pixel data from there. Even if it takes the same amount of time to read the pixel values this way, I think it would still be better since at least they would all be taken from the same screenshot (the screen pattern is changing while I'm doing this). The problem I have with this approach is that it appears the clipget() function will only return text data....

Share this post


Link to post
Share on other sites
Newb

Are the pixels you're catching scattered on the screen? What kind of comparison are you doing with these 62 pixels at time?

Depending on that it may or not may be possible to make improvements (I'm not sure anyway, it's just a theory of mine)


I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites
SpaceNinja

They're in a circle with a 200-pixel radius. If I could do it faster, I would probably grab 200 pixels on the same circle and then start grabbing concentric circles with larger radii.

The computation I'm doing is first first correllating each pixel with a particular hue and then performing peak detection around the circle. I'm fairly certain that the getpixelcolor() function is eating up the vast majority of the time during this routine, however.

Share this post


Link to post
Share on other sites
Valuater

If I recall correctly...it's been awhile.

PixelSearch ( left, top, right, bottom, color [, shade-variation [, step [, hwnd]]] )

 

I used this and changed the "step" to skip small sections knowing my colored area was larger than a few pixels

 

Hope that helps

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Newb

They're in a circle with a 200-pixel radius. If I could do it faster, I would probably grab 200 pixels on the same circle and then start grabbing concentric circles with larger radii.

The computation I'm doing is first first correllating each pixel with a particular hue and then performing peak detection around the circle. I'm fairly certain that the getpixelcolor() function is eating up the vast majority of the time during this routine, however.

 

And that's what I was going to suggest:

 

If I recall correctly...it's been awhile.

PixelSearch ( left, top, right, bottom, color [, shade-variation [, step [, hwnd]]] )

I used this and changed the "step" to skip small sections knowing my colored area was larger than a few pixels

Hope that helps

8)

 

Or PixelChecksum, which checks an area and then you can compare it again for differences.

 

By the way, this is really interesting

'?do=embed' frameborder='0' data-embedContent>>

One of the best libraries I ever used for pixel searching, and one of the fastest I can say. Takes snapshots and then compares them to see pixel changing. Very accurated and fast.

 

I'm definitely gonna give it a try, thanks for the tip!


I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites
SpaceNinja

'?do=embed' frameborder='0' data-embedContent>>

One of the best libraries I ever used for pixel searching, and one of the fastest I can say. Takes snapshots and then compares them to see pixel changing. Very accurated and fast.

 

This looks like it will do the trick. Can anyone tell me how to install it? Should I just dump all these files into my autoit3/include folder?

Edited by SpaceNinja

Share this post


Link to post
Share on other sites
SpaceNinja

I started experimenting with fast find and I'm blown away at how much faster it is! Going to have to figure out what to do with all of this power now...

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  

×