Con Posted December 24, 2007 Share Posted December 24, 2007 hey how can i find a unique colour? i dont know how to start on this one so any help is appreciated thankyou in advance Hello? Link to comment Share on other sites More sharing options...
chssoccer Posted December 24, 2007 Share Posted December 24, 2007 try PixelGetColor() Link to comment Share on other sites More sharing options...
Con Posted December 24, 2007 Author Share Posted December 24, 2007 try PixelGetColor()pixelgetcolor gets the color of a pixel that is at xcoord and ycoord butwhat do i do to find a unique pixel? Hello? Link to comment Share on other sites More sharing options...
chssoccer Posted December 24, 2007 Share Posted December 24, 2007 pixelgetcolor gets the color of a pixel that is at xcoord and ycoord butwhat do i do to find a unique pixel?what do you mean unique pixel.? Link to comment Share on other sites More sharing options...
Fossil Rock Posted December 24, 2007 Share Posted December 24, 2007 Let someone punch you in the face real hard and you'll discover lots of unique colors ..... . Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
xzaz Posted December 24, 2007 Share Posted December 24, 2007 Let someone punch you in the face real hard and you'll discover lots of unique colors ..... . Can i Can i Can I?Ontopic: you have to compare pixels, so check them all if there are more then 2 of the same color goto next Small Color Picker v0.2 | Travian bot Link to comment Share on other sites More sharing options...
Con Posted December 24, 2007 Author Share Posted December 24, 2007 (edited) by unique pixel i mean a pixel that will not be seen more than once so how do i check if there are more than 1 of the same colour. Edited December 24, 2007 by Con Hello? Link to comment Share on other sites More sharing options...
weaponx Posted December 24, 2007 Share Posted December 24, 2007 I tried this but it took about 45 seconds just to check the first row of pixels at 1280 x 1024... $test = _FindUniquePixel() MsgBox(0,"",$test) Func _FindUniquePixel() For $Y = 0 to @DesktopHeight For $X = 0 to @DesktopWidth ConsoleWrite($X & "," & $Y & @CRLF) $result = PixelGetColor ($X ,$Y ) If NOT _FindMatchingPixel($X,$Y,$result) Then Return $result EndIf Next Next Return 0x000000 EndFunc Func _FindMatchingPixel($XX,$YY,$color) For $Y = 0 to @DesktopHeight For $X = 0 to @DesktopWidth $result = PixelGetColor ($X ,$Y) If $result = $color AND NOT ($Y = $YY AND $X = $XX) Then Return true EndIf Next Next Return false EndFunc Link to comment Share on other sites More sharing options...
weaponx Posted December 24, 2007 Share Posted December 24, 2007 Here is another method. This will return the decimal value of a unique pixel if it exists, or zero if there are no unique pixels. It is rare for only one instance of a color to appear on the screen, the only way I could get this to work was to open photoshop and use the pencil tool to draw one pixel of an extreme color, then reduce the search area to only my photoshop stage. ;Max number of colors = 16777215 ;Left,Top,Width,Height $test = _FindUniquePixel2(452,438,100,100) MsgBox(0,"",$test) Func _FindUniquePixel2($LL, $TT, $WW, $HH) ;Max number of colors @ 1920x1200 = 2,304,000 ;Max number of colors @ 1680x1050 = 1,764,000 ;Max number of colors @ 1280x1024 = 1,310,720 ;Max number of colors @ 1024x768 = 786,432 ;Max number of colors @ 800x600 = 480,000 ;Possible colors @ 32-bit = 16,777,215 $Max = 16777215 Local $colorOccurences[$Max + 1] For $Y = $TT to $TT + $HH For $X = $LL to $LL + $WW $result = PixelGetColor ($X ,$Y) ;Increment count of given color $colorOccurences[$result] += 1 Next Next ;Search array for pixel with only one occurence and return the color value For $X = 0 to $Max If $colorOccurences[$X] = 1 Then Return $X Next Return 0 EndFunc 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