TeraWatt Posted September 22, 2017 Share Posted September 22, 2017 Title says all. How would I exclude pixel co-ordinates from the PixelSearch function? I.e.: At the moment it search a rectangular/square area. I want to exclude certain co-ordinates from it so that they are not checked for certain pixel colour values. Thanks in advance! Link to comment Share on other sites More sharing options...
JohnOne Posted September 22, 2017 Share Posted September 22, 2017 search a grid of rectangles, excluding your non target area. 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...
TeraWatt Posted September 22, 2017 Author Share Posted September 22, 2017 The excluded target area must be detected using program execution. Therefore I would ideally want to append the co-ordinates to an array then exclude all co-ordinates within this array when searching for pixels Link to comment Share on other sites More sharing options...
JohnOne Posted September 22, 2017 Share Posted September 22, 2017 Create a function which takes search area, and non search area, the rest is maths, which I'm lousy at. 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...
TeraWatt Posted September 22, 2017 Author Share Posted September 22, 2017 How do I input as a parameter for the PixelSearch function? Search Area would be a rectangle/square Non-Search Area would be specific points... How do I feed this into PixelSearch? Create a for loop and iterate through all points? Link to comment Share on other sites More sharing options...
JohnOne Posted September 23, 2017 Share Posted September 23, 2017 If by points you mean single pixels, then do a search, if the result is one of your points, disregard it and continue search from the next point 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...
TeraWatt Posted September 23, 2017 Author Share Posted September 23, 2017 (edited) How would I disregard it and move onto the next point? [Sorry I am new to AutoIt] Edited September 23, 2017 by TeraWatt Link to comment Share on other sites More sharing options...
JohnOne Posted September 23, 2017 Share Posted September 23, 2017 I will be happy to help if I get the time, first give detailed description of exactly what you need. "exclude points" is not enough, explain details of exact needs please. Meanwhile you should at least attempt it and show your code, whether it works or not. 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...
JohnOne Posted September 23, 2017 Share Posted September 23, 2017 As a matter of fact I believe there is something on forum that might do what you want, but might be in form of dll. "Advanced pixel search" if I recall, search that. 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...
JohnOne Posted September 23, 2017 Share Posted September 23, 2017 (edited) But here's how it could go in au3 you get the area you want to exclude, and from it calculate 5 areas around it that should be searched. Like I say it's maths and math does my head in. Here's pic to illustrate what I mean... My paint skills are akin to my maths. EDIT: I reckon these might be the calculations. ;$aArea[0]left [1]top [2]right [3]bottom Func _PixelSearchExcludeArea($iColor, $aArea) Local $aSearch1[4] = [0, 0, $aArea[0] - 1, $aArea[1] + 1];1 Local $aSearch2[4] = [$aArea[3] + 1, 0, @DesktopWidth, @DesktopHeight];2 Local $aSearch3[4] = [0, $aArea[1], $aArea[0] - 1, @DesktopHeight];3 Local $aSearch4[4] = [0, $aArea[3] + 1, $aArea[2] + 1, @DesktopHeight];4 Local $aSearch5[4] = [$aArea[0], 0, $aArea[2], $aArea[1] - 1];5 EndFunc ;==>_PixelSearchExcludeArea Edited September 23, 2017 by JohnOne 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...
TeraWatt Posted September 23, 2017 Author Share Posted September 23, 2017 (edited) Yes, I have read this. The problem is that this approach requires you to know, prior to program execution, the area to exclude. I want to ignore multiple points as the program runs, this means the above approach is not sufficient as there would be way too many rectangles (I.e.: I would have to re-calculate each time a new point is to be ignored). My proposed solution, which I have yet to test, is to iterate through all points on the co-ordinate axis I wish to search (this would be the initial area) and append these values to an array. I.e.: Global $Array = [(x,y), (x2,y2), (...)] [$Array contains all legal pixels to be checked] I would then remove co-ordinates that should be excluded from this array. Each point in $Array would become the parameter of the PixelSearch function, I.e.: PixelSearch ( $Array[0][0], $Array[0][1], $Array[0][0]+1, $Array[0][1]+1, <colour code> ) As each pixel is 1x1 (hence the increment of 1). Checks would be performed in a loop, iterating through all points in $Array. [I am new to AutoIt, the list slicing I am performing is as a result of my Python intuition, also these points may be incorrect] Edited September 23, 2017 by TeraWatt Link to comment Share on other sites More sharing options...
TeraWatt Posted September 23, 2017 Author Share Posted September 23, 2017 13 minutes ago, JohnOne said: But here's how it could go in au3 you get the area you want to exclude, and from it calculate 5 areas around it that should be searched. Like I say it's maths and math does my head in. Here's pic to illustrate what I mean... My paint skills are akin to my maths. A more efficient approach would only require 4 rectangles. In my problem multiple black squares are scattered around so this would not be feasible. Link to comment Share on other sites More sharing options...
JohnOne Posted September 23, 2017 Share Posted September 23, 2017 24 minutes ago, TeraWatt said: A more efficient approach would only require 4 rectangles. Perhaps, but problems might arise if area was top of screen, so more coding. Your approach sounds better for your goals. 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...
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