Jump to content

# Finding an odd color on the screen

## Recommended Posts

Hello everybody,

I'm currently building a bot for a game (I'm sure lots of people can guess which one), and I'm in need of something i have never seen done before.

I need to find a unique color of the screen, but with tolerance and it must be fast.

Im thinking of dividing the screen into areas, say 20*30 boxes, and getting the average color for each box. Then somehow i have to find out which differs from the rest.

The search area will be one color mostly, some different shades may be there, but it will mostly be the same.

How would i go and get an average color for a box? Something with pixelgetchecksum perhaps?

And how would you compare all the results and extract the odd one?

I've been messing around for a while, but couldn't come up with anything that even remotely got any results.

Any input is greatly appreciated!

Ps, i tried searching. But the only threat i found was of a guy that wanted something similar, but he only got made fun of.

Nick

##### Share on other sites

Im thinking of dividing the screen into areas, say 20*30 boxes, and getting the average color for each box. Then somehow i have to find out which differs from the rest.

The search area will be one color mostly, some different shades may be there, but it will mostly be the same.

Problem is, dividing by those numbers doesn't always make an even number, thus the average wont be correct.
##### Share on other sites

Problem is, dividing by those numbers doesn't always make an even number, thus the average wont be correct.

I found a way to get the average color, which is really simple and accurate

get the pixelcolor for each .. 5 pixels of the screen (or any other number based on accuracy)

add all those together and divide by the number of samples taken.

works perfectly and fast.

next thing should be an inverted pixelsearch, any suggestions?

Edited by koekje
##### Share on other sites

I found a way to get the average color, which is really simple and accurate

get the pixelcolor for each .. 5 pixels of the screen (or any other number based on accuracy)

add all those together and divide by the number of samples taken.

works perfectly and fast.

next thing should be an inverted pixelsearch, any suggestions?

Look at prospeed. It's DLL written in assembler containing many usefull fast graphic functions. It has wrapper for AutoIt so you can easily implement calling it from your scripts.

http://www.autoitscript.com/forum/index.ph...ospeed&st=0

As about reverse pixelsearch - It's done in latest beta 3.3.1.0

Edited by Zedna
##### Share on other sites

Look at prospeed. It's DLL written in assembler containing many usefull fast graphic functions. It has wrapper for AutoIt so you can easily implement calling it from your scripts.

http://www.autoitscript.com/forum/index.ph...ospeed&st=0

As about reverse pixelsearch - It's done in latest beta 3.3.1.0

Woa, thanks so much for the link and info!

Much appreciated!

## 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
• ### Recently Browsing   0 members

• No registered users viewing this page.
×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...