majed Posted October 10, 2009 Share Posted October 10, 2009 Hi; my target is to recognize numbers (changing) in a certain fixed position in screen; which is not been able to be seen by Autoit information tool,and do actions when the target number reached (or above), I tried pixlchicksum, but I couldnt achive good results; then I used screen capture for the spicific rectangle in screen, and save it as jpg; then calculate the size of the file which can determain every numeric from 0 to 9, I have 2 colors one black (positive) and red (negative) and the code should be run when the color of thr numers terns to black, it works but I need ideas for improvement in my code; since I am new in programing: _ScreenCapture_Capture(@MyDocumentsDir & "\1.jpg",$left,$top,$right,$bottom) ;$size=PixelChecksum($left,$top,$right,$bottom) ;Sleep(2000) ;Next $size=FileGetSize(@MyDocumentsDir & "\1.jpg") MsgBox(0,"",$size) if $size=1266 then MsgBox(0,"The number is",0);black if $size=953 then MsgBox(0,"The number is",1);black if $size=1102 then MsgBox(0,"The number is",2);black if $size=1278 then MsgBox(0,"The number is",3);black if $size=1104 then MsgBox(0,"The number is",4);black if $size=1 then MsgBox(0,"The number is",5);black if $size=1283 then MsgBox(0,"The number is",6);black if $size=999 then MsgBox(0,"The number is",7);black if $size=1299 then MsgBox(0,"The number is",8);black if $size=1284 then MsgBox(0,"The number is",9);black if $size=1 then MsgBox(0,"The number is",0);red if $size=1001 then MsgBox(0,"The number is",-1);red if $size=1155 then MsgBox(0,"The number is",-2);red if $size=1294 then MsgBox(0,"The number is",-3);red if $size=1 then MsgBox(0,"The number is",-4);red if $size=1280 then MsgBox(0,"The number is",-5);red if $size=1303 then MsgBox(0,"The number is",-6);red if $size=1 then MsgBox(0,"The number is",-7);red if $size=1323 then MsgBox(0,"The number is",-8);red if $size=1 then MsgBox(0,"The number is",-9);red Link to comment Share on other sites More sharing options...
FuryCell Posted October 10, 2009 Share Posted October 10, 2009 Perhaps PixelChecksum would be more efficient? HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
jebus495 Posted October 10, 2009 Share Posted October 10, 2009 Perhaps PixelChecksum would be more efficient?Are the numbers always in the same spot?If so you can probably use 2-3 PixelGetColor's for each number to determine it's value. Link to comment Share on other sites More sharing options...
majed Posted October 10, 2009 Author Share Posted October 10, 2009 Are the numbers always in the same spot?If so you can probably use 2-3 PixelGetColor's for each number to determine it's value.yes its in the same spot ; i tryed pixlchicsum but it was not accurae; how can I use 2-3 PixelGetColor's for each number to determine it's value?screen capture is highly acurate but can I know the size(in kb)when the screen capture without saving to jpr; I mean is the image content became in the clickboard and I can know its size without saving the image? Link to comment Share on other sites More sharing options...
jebus495 Posted October 12, 2009 Share Posted October 12, 2009 yes its in the same spot ; i tryed pixlchicsum but it was not accurae; how can I use 2-3 PixelGetColor's for each number to determine it's value?screen capture is highly acurate but can I know the size(in kb)when the screen capture without saving to jpr; I mean is the image content became in the clickboard and I can know its size without saving the image?I'm sure there are more fluid ways than what I'm about to show but w/e.Here is an example of what I mean.Save that image, open it up and zoom WAY IN. You'll notice pink marks. If you get the color of each pixel in that + shape you can, depending on which colors are white and black determine what number it is.Essentially an EXTREMELY basic OCR system.Okay so 9 PixelGetColor's is a bit more than what I said but I think it goes pretty quick.So your zero basically looks like this zoomed in:XOOOXOXXXOOXXXOOXXXOOXXXOOXXXOOXXXOXOOOXSo if you use 9 PixelGetColors like this...XOOOXOXXXOOXXXOOXXXOOXXXOOXXXOOXXXOXOOOXAssuming the numbers have an even spacing per character you could write a script to get the color on the 9 different spots over the numbers and you could match certain patterns that would be unique to each number.If anyone has an example of something like this it would be great because I'm not certain I've done a quality job of explaining what I mean. 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