TeraWatt

How to exclude co-ordinates from PixelSearch

13 posts in this topic

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!

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

How would I disregard it and move onto the next point?

 

[Sorry I am new to AutoIt]

Edited by TeraWatt

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#10 ·  Posted (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...

exclude.jpg

 

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 by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#11 ·  Posted (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 by TeraWatt

Share this post


Link to post
Share on other sites
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...

exclude.jpg

 

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. 

Share this post


Link to post
Share on other sites
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.

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