Jump to content
Sign in to follow this  

help or advice to improve pixel(s) detection

Recommended Posts


I've managed to write the code below. Detection is partially working tho it is far from satisfactory.

In resume, screen is divided in a couple of area and each area is searched for a number of pixels.

The pixel closer to the geometrical mean (?) is chosen to aquire the target. So far, the size of the areas is customizable and also the number of pixels required to aquire a target.

Func Scan()

___$shadevariation = GUICtrlRead($input_sv)

___$step = GUICtrlRead($input_step)

______for $i=0 to $nbAreas-1




Func scanArea($areaNb)




___Dim $ppos

___Dim $storePos[$nbPixels][2]

___Dim $targetCoord

___for $i=0 to $nbMonster-1

______for $c=0 to $nbPixels-1

_________$ppos=getPosition($areaNb, $i, $c)

_________If $errorstatus == 0 Then








___if $found >= $plimit Then











Func getPosition($areaNb, $monsterNb, $pixelNb)

___Dim $ppos


___If Not @error Then





___return $ppos


Func getTargetCoord($coordPixels,$gMeanX,$gMeanY,$nbPix)



___Dim $coord[2]



___for $i=0 to $nbPix-1

______If (ABS($coordPixels[$i][0] - $gMeanX)) < (ABS($coord[0] - $gmeanX)) Then $coord[0]=$coordPixels[$i][0]

______If (ABS($coordPixels[$i][1] - $gMeanY)) < (ABS($coord[1] - $gmeanY)) Then $coord[1]=$coordPixels[$i][1]


___return $coord


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

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.