Jump to content
Sign in to follow this  
majed

recognizing screen numbers

Recommended Posts

majed

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

Share this post


Link to post
Share on other sites
jebus495

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.

Share this post


Link to post
Share on other sites
majed

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?

Share this post


Link to post
Share on other sites
jebus495

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.

Posted Image

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:

XOOOX

OXXXO

OXXXO

OXXXO

OXXXO

OXXXO

OXXXO

XOOOX

So if you use 9 PixelGetColors like this...

XOOOX

OXXXO

OXXXO

OXXXO

OXXXO

OXXXO

OXXXO

XOOOX

Assuming 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.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×