SpaceNinja Posted September 8, 2013 Share Posted September 8, 2013 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 More sharing options...
Newb Posted September 8, 2013 Share Posted September 8, 2013 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 More sharing options...
SpaceNinja Posted September 8, 2013 Author Share Posted September 8, 2013 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 More sharing options...
Valuater Posted September 8, 2013 Share Posted September 8, 2013 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) Link to comment Share on other sites More sharing options...
Solution AutID Posted September 8, 2013 Solution Share Posted September 8, 2013 '?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. https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
Kidney Posted September 9, 2013 Share Posted September 9, 2013 there is also imagesearch. Link to comment Share on other sites More sharing options...
Newb Posted September 9, 2013 Share Posted September 9, 2013 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 More sharing options...
SpaceNinja Posted September 13, 2013 Author Share Posted September 13, 2013 (edited) '?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 September 13, 2013 by SpaceNinja Link to comment Share on other sites More sharing options...
AutID Posted September 14, 2013 Share Posted September 14, 2013 It doesn't need any installations. Just put the files in the same folder as you script. The #include will work. https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
SpaceNinja Posted September 14, 2013 Author Share Posted September 14, 2013 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... 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