Jump to content

How to speed up pixelgetcolor()


Go to solution Solved by AutID,

Recommended Posts

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....

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

'?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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...