sandeep Posted June 23, 2008 Share Posted June 23, 2008 need help , when I run the script with the example bmp it only return " . " or " .. " instead of numbers. ------------------------------------------#include "NumCR.au3"$test = _OCR(0, 0, 300, 300)MsgBox(0, "Example", $test)------------------------------------------Is it working?? Link to comment Share on other sites More sharing options...
ian.b Posted September 30, 2008 Share Posted September 30, 2008 Is it working??Yes, it works just fine for me - I would like to thank pingpong24 for sharing.The critical thing is to build the proper definition for used font/size,some string manipulation may be needed to remove extra dots.ian Link to comment Share on other sites More sharing options...
xlamik Posted December 17, 2008 Share Posted December 17, 2008 I little modified the script for NumCR. In my version, I count the number of pixels in area to determine number (or another character). And to distinct the numbers with the same numbers of pixels (2 and 4, 6 and 9 in my case) I added some multiplicity factor to next row. It means that next row have bigger value than previous and using this method I was able to generate different patters to different number. Before usage you must modify the script to set the number of pixels for every digit you will use. Also different multiply strategies and values can be used to generate unique pattern. expandcollapse popupFunc _OCR($Ax, $Ay, $Dx, $Dy) $width = $Dx - $Ax $length = $Dy - $Ay Dim $char = 0; Dim $sign = 1 For $xwidth = 0 To $width - 1 For $xlength = 0 To $length - 1 If PixelGetColor($Ax+$xwidth, $Ay+$xlength) = 0 Then $char += $sign ; or 1*$sign, 2*$sign. For unique pattern EndIf Next If $char <> 0 Then $sign += 1 ; increase the row multiply factor to avoid the same # of black pixels in different numbers EndIF Next Select Case $char = 152 $result = 0 Case $char = 80 $result = 1 Case $char = 120 $result = 2 Case $char = 138 $result = 3 Case $char = 126 $result = 4 Case $char = 130 $result = 5 Case $char = 131 $result = 6 Case $char = 102 $result = 7 Case $char = 156 $result = 8 Case $char = 149 $result = 9 EndSelect Return $result EndFunc Link to comment Share on other sites More sharing options...
Root_ Posted July 5, 2017 Share Posted July 5, 2017 I know this is an extreme gravedig. But I am working on a project and trying to get some OCR for numbers only -- something like this that I can customize to my own liking/text. I tried using tesseract and it kept messing up changing digits to random characters. From what it looks like in this script i am to specify the text color on line 24, which happens to be green (4dc92b) then count the green pixels of each column from top to bottom -- here is an image of what I envision I am supposed to do, please correct me if im wrong. The numbers in the picture represent each vertical pixel. meaning that my if statement to catch that number should look like the code below, right? If $row[$xwidth] = 5 And $row[$xwidth+1] = 3 And $row[$xwidth+2] = 3 And $row[$xwidth+3] = 3 And $row[$xwidth+4] = 5 Then $result &= "8" EndIf I am willing to pay a few bucks to anyone that can get this text to recognize for me using this lightweight OCR. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 6, 2017 Moderators Share Posted July 6, 2017 What is the app that you're pulling the numbers from (desktop app, web app, etc.)? Are you not able to get any info with the AutoIt Window Info Tool, that you have to resort to OCR? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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