lingo124 Posted May 23, 2013 Share Posted May 23, 2013 (edited) I am trying to figure out a way to process images to single out a specific color. I have a camera that takes pictures of the ground from a r/c plane and need to find out a target in a patch, or sea, of green grass. The problem is, I don't know how to work with the pixelgetcolor thing. I tried converting it to hex but still no bueno because I need to have some sort of tolerance. For example, if the G in the RGB is maybe 2 digits greater I still want to categorize it as grass. Does anybody know of a way to easily get the RGB value? I tried converting to hex and the converting to RGB using some shady function (dont remember if it was UDF). That didn't work out too well for me. Thanks. edit: It takes hundreds of pictures which is why I need to use automation. Plus I think autoit would probably be easier than using matlab. Edited May 23, 2013 by lingo124 Link to comment Share on other sites More sharing options...
JohnOne Posted May 23, 2013 Share Posted May 23, 2013 "some shady function that didn't work out too well for me." is not quite the descriptive info which will get you the help you need really. #include <Color.au3> #include <Array.au3> $colour = PixelGetColor(10,10) $aRGB = _ColorGetRGB($colour) _ArrayDisplay($aRGB) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
lingo124 Posted May 23, 2013 Author Share Posted May 23, 2013 "some shady function that didn't work out too well for me." is not quite the descriptive info which will get you the help you need really. #include <Color.au3> #include <Array.au3> $colour = PixelGetColor(10,10) $aRGB = _ColorGetRGB($colour) _ArrayDisplay($aRGB) LOL wait I take that back. I was using _ColorGetRGB. I just assumed it was UDF cause the function was proceeded with an underscore. I did try that function using the example from the help page of ColorGetRGB as a basis. However, in the parameters it specified that the parameter was "The RGB color to work with (0x00RRGGBB)." Which made no sense to me since I am trying to get the RGB values. So I tried plugging in the hex of PixelGetColor to no avail. Does the _ColorGetRGB take the decimal representation of color? Because in the example code on that page it shows #include <Color.au3> Local $nColor = 0x8090ff Local $aColor = _ColorGetRGB($nColor) MsgBox(4096, "AutoIt", "Color=" & Hex($nColor) & @CRLF & " Red=" & Hex($aColor[0], 2) & " Blue=" & Hex($aColor[1], 2) & " Green=" & Hex($aColor[2], 2)) In that example, the $nColor is not a decimal color at all, since decimal colors don't have letters in them as far as I know. Im confused. Link to comment Share on other sites More sharing options...
BrewManNH Posted May 23, 2013 Share Posted May 23, 2013 As far as AutoIt is concerned 0x8090FF and 8425727 are the same number, one is in base 16, the other is in base 10. You can use them interchangably. lingo124 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator 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