| View previous topic :: View next topic |
| Author |
Message |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Sat Sep 11, 2004 11:47 am Post subject: Get pixel count for specified region & color |
|
|
This small subroutine might be useful to someone. It retrieves the number of pixels in a region that match a certain color: | Code: | GPC_Color = 0x3444b0
GPC_X1 = 100
GPC_X2 = 150
GPC_Y1 = 100
GPC_Y2 = 150
Gosub GetPixelCount
if PixelCount > 7
{
...
}
return
GetPixelCount:
PixelCount = 0
GPC_X = %GPC_X1%
Loop
{
if GPC_X > %GPC_X2%
break
GPC_Y = %GPC_Y1%
Loop
{
if GPC_Y > %GPC_Y2%
break
PixelGetColor, GPC_ColorTemp, %GPC_X%, %GPC_Y%
if GPC_ColorTemp = %GPC_Color%
++PixelCount
++GPC_Y
}
++GPC_X
}
return |
|
|
| Back to top |
|
 |
ProfessorY91
Joined: 03 Mar 2008 Posts: 12 Location: Inside your mind.
|
Posted: Mon Mar 03, 2008 2:21 pm Post subject: Thanks! |
|
|
Is there any way to get a complete list of hex colors of a specified region?
i.e. I am looking to differentiate between a certain shade of red and blue, but red is not the majority color (and thus there are many many colors to try when i use your subroutine)
Thanks!
Um... if you could take a look at the topic labeled
Image Search Fails to recognize screenshot if trigger (game)
http://www.autohotkey.com/forum/viewtopic.php?t=29258
Would be much appreciated. An expert could tell me what im doing wrong in a few secs im sure. _________________

  |
|
| Back to top |
|
 |
|