dynamicfusion Posted April 11, 2013 Share Posted April 11, 2013 PixelSearch currently returns back an array of the first pixel location found that matches a color. What if I wanted it to not stop at the first pixel? I want to keep scanning the rest of the region to gather data where other identical pixels might be such as a green tennis ball, with the goal of finding the center average coordinates. What functions can I use to make this happen? I do not want to soak the CPU by running multiple PixelSearches if I can help avoid it, one pass should be sufficient. My theory is to take a bitmap, dump that into an array, forloop through the array, find all locations of a specific color and then determine the shape's boundary of our "green" object and finally give the center location of it...Thank you. Link to comment Share on other sites More sharing options...
Bert Posted April 11, 2013 Share Posted April 11, 2013 What application are you working with? There may be a better way than to use a pixel search to do what you want. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
JohnOne Posted April 11, 2013 Share Posted April 11, 2013 There is an advanced pixel udf in example scripts that might be of use. Also Image search udf (Find bmp in another bmp) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
dynamicfusion Posted April 11, 2013 Author Share Posted April 11, 2013 I am using the FindFast.au3 functions but even then, there are no center weight average algorithms. How would I attack the logic with this? Link to comment Share on other sites More sharing options...
JohnOne Posted April 11, 2013 Share Posted April 11, 2013 I think you are describing pattern recognition, way out of my league. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
dynamicfusion Posted April 11, 2013 Author Share Posted April 11, 2013 No its not anything like pattern recognition. I simply need to find for example, the center of a red circle. Not the nearest first pixel like it does now. Link to comment Share on other sites More sharing options...
JohnOne Posted April 11, 2013 Share Posted April 11, 2013 If you find one pixel with pixelsearch, then multiple calls to Pixelgetcolor in three directions opught to give you the top left right and bottom of the image. Of course you can find an image such as a circle with udf I mentioned above. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
dynamicfusion Posted April 11, 2013 Author Share Posted April 11, 2013 I just looked at the info for PixelGetColor and it does not have any attributes regarding direction. Link to comment Share on other sites More sharing options...
JohnOne Posted April 11, 2013 Share Posted April 11, 2013 It tests the colour where you tell it too. Given that you know the position of a particular part of the object, it is up to you to tell it where to check x+1, y+1 etc... AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
dynamicfusion Posted April 11, 2013 Author Share Posted April 11, 2013 I don't know the position. The ball might be moving around the screen. The pixelsearch function is useless because the location it returns is completely random since it stops immediately after detecting only one of then pixels. This means it's reporting an edge of the circle, not the middle of it. Link to comment Share on other sites More sharing options...
JohnOne Posted April 11, 2013 Share Posted April 11, 2013 OK. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 11, 2013 Developers Share Posted April 11, 2013 Please read our forum rules about Game automation. *click* SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts