Sign in to follow this  
Followers 0
Seedorf

PixelChecksum?

13 posts in this topic

Hi guys I cant get this pixelchecksum to work. And Im wondering if you could help me.

For example if I want it to read this: -----> THIS <---------

then how do I do?

In the help file it says: PixelChecksum ( left, top, right, bottom)

I have done this with X-koordinates but nothing happend.

And how small should this rectangle be? Just so the word fits in or what?

Thanks in advance

Share this post


Link to post
Share on other sites



Use the Autoit Window info tool to get the coords, then pop them where they belong.

The rectangle should be as small as the area you are checksumming.

Just measure the bottom left point and the top right point, then take out the individual numbers and put them in.

i.e. bottom left is 50, 200, top right is 100, 75

put them in like (50,75,100,200)

I used random numbers... doesn't matter...

Just use the window info tool, and you'll be fine. Read through the code sample in the helpfile too.

Sparkes.


---Sparkes.

Share this post


Link to post
Share on other sites

Hi guys I cant get this pixelchecksum to work. And Im wondering if you could help me.

For example if I want it to read this: -----> THIS <---------

then how do I do?

In the help file it says: PixelChecksum ( left, top, right, bottom)

I have done this with X-koordinates but nothing happend.

And how small should this rectangle be? Just so the word fits in or what?

Thanks in advance

In case that's what you were looking for: PixelChecksum() is not an optical character recognition (OCR) function. Search the forums for OCR and you'll find some other solutions for that, which may make use of PixelChecksum(), however.

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

PSaltyDS is correct, what you're in search of is a OCR. Searching the forums will point you to some examples, but you will need to custom tailor the OCR to suit your needs. Things like the scan area will need adjustment, and possibly the font color, but the most important part... is the font size. No OCR listed in this forum will recognize font of any size, they are tailored to a specific size. If you create a OCR which will read any font size and scan any area for fonts of any color, and do all of this in a timely manner, then you've really got something there. :wacko:

Nomad :D


Share this post


Link to post
Share on other sites

Hi guys again. I have read about this OCR but I still dont understand how to do it.

My situation is like this, I want OCR to read in a rectangle and if that number is between 0-100 then

I want to do a mouseclick() and if it between 100-200 then I want another mouseklick().

The problem is that I dont know how to write a script that tells you whats inside the rectangle.

Position of rectangle: UpperLeft (595, 440) UpperRight (664, 440) DownLeft (595, 454) DownRight (664, 454)

Backround color: Dec = 14537153 RGB: Hex 0xDDD1C1

Number color: Dec = 0 RGB: Hex: 0x000000

Font: MS Sans Serif Bold 8

There are 2 pic at the rectangle.

Is this hard to do? I would appriciate all help I get.

Help.bmp

Help2.bmp

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Hi guys again. I have read about this OCR but I still dont understand how to do it.

My situation is like this, I want OCR to read in a rectangle and if that number is between 0-100 then

I want to do a mouseclick() and if it between 100-200 then I want another mouseklick().

The problem is that I dont know how to write a script that tells you whats inside the rectangle.

Position of rectangle: UpperLeft (595, 440) UpperRight (664, 440) DownLeft (595, 454) DownRight (664, 454)

Backround color: Dec = 14537153 RGB: Hex 0xDDD1C1

Number color: Dec = 0 RGB: Hex: 0x000000

Font: MS Sans Serif Bold 8

There are 2 pic at the rectangle.

Is this hard to do? I would appriciate all help I get.

Simply, you'll have to put in a database of every pixel checksum for the region you're looking for for the numbers 0 through 9 in a rectangle just large enough to fit the number, as well as a chunk of blank screen in that rectangle in the event that the counter doesn't display leading zeros (IE: 001 or 023).

If the font ever changes, happy re-coding!

I'll post an example when I get home to help clarify if no one else does before I do.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Stupid question, is the text you are looking for in a textbox? If it is, why not just get the control text? If it is not, good luck on OCR.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Not much help here, but your missing the number 0 to get the full number effect.

Making an OCR is VERY time consuming... You have to make sure you have every char pre mapped so to speak with pre-determined check sum values.

The issue you are going to run into is you have to have the width of each char and height, then your going to have to do a checksum value for each char individually with the background color etc... Checksum isn't color specific, so it has to be the same colors on everything, so in this case you would have 3 different checksums for the number 0 to 9, 1 has the default background, 1 has a red back ground and the other has a green back ground.

Global $1stSumBackGround[10] = [1093120948019, 10934102481092, 12093481029830129 etc....]
Global $2ndSumBackGround[10] = [091481009123409, 091301283012, 19203210983, etc....]
Global $3rdSumBackGround[10] = [9084012930812, 291038102938910, 1209382108301928, etc...]
Global $Number[10] = [0,1,2,3,4,5,6,7,8,9]
Global $YTop = 100 ; just an example - This will be the very top of where the numbers start for y position
Global $HeightOfChar = 8 ; height of the character
Global $WidthOfChar = 5 ; width of character
Global $MyValue = ''; This is what will store the characters throughout the loop
Global $WidthOfCharOne = 3;The number 1 is usually 1 to 2 pixels smaller in width than the rest of the numbers
Global $XEndingPoint = 200; Far right side of the box to check
Global $XStartingPoint = 100;Far left side of the box to stop checking
Global $NumberFound = 0

For $x = $XEndingPoint To $XStartingPoint Step - 1;x right to left, so it would be the right most area that you would want to search.
    $PixSum = PixelCheckSum($x, $YTop, $x + $WidthOfChar, $YTop + $HeightOfChar)
    For $i = 0 To 9
        If $i <> 1 And ($PixSum = $1stSumBackGround[$i] Or $PixSum = $2ndSumBackGround[$i] Or $PixSum = $3rdSumBackGround[$i]) Then
            $MyValue = $Number[$i] & $MyValue;have to do it this way because we are going right to left
            $NumberFound = 1
            ExitLoop
        EndIf
    Next
    If Not $NumberFound Then
        $PixSum = PixelCheckSum($x, $YTop, $x + $WidthOfCharOne, $YTop + $HeightOfChar)
        If $PixSum = $1stSumBackGround[1] Or $PixSum = $2ndSumBackGround[1] Or $PixSum = $3rdSumBackGround[1] Then
            $MyValue = $Number[1] & $MyValue;have to do it this way because we are going right to left
        EndIf
    EndIf
    $NumberFound = 0
Next

MsgBox(64, 'Info:', $MyValue)oÝ÷ ØGb·abÅçZ"r+,¹â0jÇ!yÉ"©¶mg¬ø­Á«-é^¶×«Õú+y§!¦,^¹bAÝÓ+¢é]mç¯zwڲ׫Â+aihbéh¢®¶­sdvÆö&Âb33c³7E7VÔ&6´w&÷VæE³ÒÒ³3#CÂ3C#C"Â#3C#3#WF2âââåФvÆö&Âb33c³&æE7VÔ&6´w&÷VæE³ÒÒ³C#3CÂ3#3"Â#3#2ÂWF2âââåФvÆö&Âb33c³7&E7VÔ&6´w&÷VæE³ÒÒ³C#3"Â#3#3Â#3#3#ÂWF2ââåФvÆö&Âb33c´çVÖ&W%³ÒÒ³ÃÃ"Ã2ÃBÃRÃbÃrÃÃФvÆö&Âb33cµF÷Ò²§W7BâW×ÆRÒF2vÆÂ&RFRfW'F÷öbvW&RFRçVÖ&W'27F'Bf÷"÷6Föà¤vÆö&Âb33c´VvDöd6"Ò²VvBöbFR6&7FW ¤vÆö&Âb33cµvGFöd6"ÒR²vGFöb6&7FW ¤vÆö&Âb33c´×fÇVRÒb33²b33³²F22vBvÆÂ7F÷&RFR6&7FW'2F&÷Vv÷WBFRÆö÷¤vÆö&Âb33cµvGFöd6$öæRÒ3µFRçVÖ&W"2W7VÆÇFò"26ÖÆÆW"âvGFFâFR&W7BöbFRçVÖ&W'0¤vÆö&Âb33cµVæFæuöçBÒ#²f"&vB6FRöbFR&÷Fò6V6°¤vÆö&Âb33cµ7F'FæuöçBÒ´f"ÆVgB6FRöbFR&÷Fò7F÷6V6¶æp¤vÆö&Âb33c´çVÖ&W$f÷VæBÒ ¥vÆRb33cµVæFæuöçBfwC³Òb33cµ7F'FæuöçBÒ b33cµVæFæuöçBÓÒ¢b33cµ7VÒÒVÄ6V6µ7VÒb33cµVæFæuöçBÂb33cµF÷Âb33cµVæFæuöçB²b33cµvGFöd6"Âb33cµF÷²b33c´VvDöd6"¢f÷"b33c¶ÒFò¢bb33c¶fÇC²fwC²æBb33cµ7VÒÒb33c³7E7VÔ&6´w&÷VæE²b33c¶Ò÷"b33cµ7VÒÒb33c³&æE7VÔ&6´w&÷VæE²b33c¶Ò÷"b33cµ7VÒÒb33c³7&E7VÔ&6´w&÷VæE²b33c¶ÒFVà¢b33c´×fÇVRÒb33c´çVÖ&W%²b33c¶Òfײb33c´×fÇVS¶fRFòFòBF2v&V6W6RvR&Rvöær&vBFòÆVg@ b33c´çVÖ&W$f÷VæBÒ b33cµVæFæuöçBÓÒb33cµvGFöd6"Ò¢WDÆö÷ VæD`¢æW@ bæ÷Bb33c´çVÖ&W$f÷VæBFVà b33cµ7VÒÒVÄ6V6µ7VÒb33cµVæFæuöçBÂb33cµF÷Âb33cµVæFæuöçB²b33cµvGFöd6$öæRÂb33cµF÷²b33c´VvDöd6" bb33cµ7VÒÒb33c³7E7VÔ&6´w&÷VæE³Ò÷"b33cµ7VÒÒb33c³&æE7VÔ&6´w&÷VæE³Ò÷"b33cµ7VÒÒb33c³7&E7VÔ&6´w&÷VæE³ÒFVà b33c´×fÇVRÒb33c´çVÖ&W%³Òfײb33c´×fÇVS¶fRFòFòBF2v&V6W6RvR&Rvöær&vBFòÆVg@ b33cµVæFæuöçBÓÒb33cµvGFöd6$öæRÒ VæD` VæD` b33c´çVÖ&W$f÷VæBÒ¥tVæ@ ¤×6t&÷cBÂb33´æfó¢b33²Âb33c´×fÇVR
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Thanks so much SmOke_N I really appreciate it.

I only got one question about your script, I still wonder where you get these numbers from and what are they? I understand that I got to check the numbers with the height, width and backgroundcolor.

Global $1stSumBackGround[10] = [1093120948019, 10934102481092, 12093481029830129 etc....]

Global $2ndSumBackGround[10] = [091481009123409, 091301283012, 19203210983, etc....]

Global $3rdSumBackGround[10] = [9084012930812, 291038102938910, 1209382108301928, etc...]

Now lets hope everything work out well :D

Edited by Seedorf

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Thanks so much SmOke_N I really appreciate it.

I only got one question about your script, I still wonder where you get these numbers from and what are they? I understand that I got to check the numbers with the height, width and backgroundcolor.

Global $1stSumBackGround[10] = [1093120948019, 10934102481092, 12093481029830129 etc....]

Global $2ndSumBackGround[10] = [091481009123409, 091301283012, 19203210983, etc....]

Global $3rdSumBackGround[10] = [9084012930812, 291038102938910, 1209382108301928, etc...]

Now lets hope everything work out well :D

You have to do a seperate PixelCheckSum() for each letter (like in MsPaint), the width and the height.... so let's say I had MsPaint Open, my width was 5 pixels and my height was 8, I need to start from 0 to 9 on my numbers and place them in that array, I will have 10 sets of number each set seperated by a comma between those brackets, each set representing a number with that background.

I open MsPaint / open my .bmp (must be a .bmp)... go to my number, using Client Coords on my AutoInfo tool (Options >> Coord Mode >> Client), then in my script I would do something like:

Opt('PixelCoordMode', 2) ; 2 representing the client coords of the window
$xStart = Far Right of where the number starts coords from AutoInfo
$yStart = Top of where number starts coords from AutoInfo
$Zero1 = PixelCheckSum($xStart, $yStart, $xStart + $iWidth, $yStart + $yHeight)
ClipPut($Zero1) ; Now my sum for 0 with one of the 3 backgrounds is stored on the clipboard just need to paste it somewhere for storage
You'll do this 30 times, 3 times for each background / each character.

Edit:

Had MouseCoordMode ... Should have been PixelCoordMode!!

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Oki now I understand thank you so much :D

Share this post


Link to post
Share on other sites

ehh I think I got a problem because the pixelchecksum from number 2, 5, 7 and 8 are all the same. With red backround, green and default all the same. Can this be right?

Share this post


Link to post
Share on other sites

ehh I think I got a problem because the pixelchecksum from number 2, 5, 7 and 8 are all the same. With red backround, green and default all the same. Can this be right?

I've not seen it the same for that many characters, sometimes 8 and 0 ... or 6 and 9 but never 4 different numbers the same personally.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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  
Followers 0