Sign in to follow this  
Followers 0
awayne

ocr tesseract

19 posts in this topic

ok for my programming project checksums would work for sure however it is going to take a very long time to acquire all the checksum values i need to capture to recognize what is on the screen for a given area.

I have not done much ocr work with autoit but i would not mind using tesseract since it is maintained by google and I know if google developers are maintaining the code then tesseract should be solid for ocr

before i start down a wrong path i want to make sure I am taking the correct approach.  for several thousand different values checksuming each value just doesnt seem optimal.

I think in ocr the ocr just learns the chars so i would screencapture on an area and read in the value.

if someone could provide me more insight on setting this up that would be great

Share this post


Link to post
Share on other sites



john giving the 1000s of checksums i would have to do do you believe the ocr is the best approach here?

Share this post


Link to post
Share on other sites

awayne,

Can you post a screenshot of what it is you are trying to recognise? Then we might be able to offer a better way - neither "1000s of checksums" nor OCR sound very sensible. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Sorry for the sidenote, but google hasnt done anything for tesseract, they "took over" development from someone else, but havent made anything to it, no credit to them that it actually works, that's the work of other guys.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Ok playing around with tesseract ocr udf and tesseractsimple udf and I had to change the path to the new tesseract path old is tesseracttesseract.exe new is Tesseract-OCR

program will just not work if path isnt changed in tesseract udf I do however get the following error

>"C:Program Files (x86)AutoIt3SciTE..autoit3.exe" /ErrorStdOut "C:UserslapDesktopocr.au3"

"C:UserslapDesktopSimpleTesseract.au3" (136) : ==> Variable must be of type "Object".:

$Obj1.ShowFile ($capture_filename, 1)

$Obj1^ ERROR

>Exit code: 1 Time: 0.713

my code might help, lol

#include <SimpleTesseract.au3> #include <MsgBoxConstants.au3> $OCR_Result = _TesseractScreenCapture(0,"",1,1,827,172,1072,189,1) MsgBox($MB_SYSTEMMODAL, "OCR", $OCR_Result)
I want tesseract to read in an area and come back with the text value in a message box

also just tried the older version of tesseract ocr the original version the developer of the udf was using 2.0.1

Ok I am trying very hard to get this working I got the code to run and the problem was if using vista or above windows there is no image fax viewer program so you have to remove that param or set it to 0 in the code.

I have tried both the older version of tesseract 2.0.1 and the latest version my message box all i get is a white block

:(

If anyone can run my current code I would be greatly appreciative if you have the Tesseract.au3 udf please try my code not sure why my msgbox is only getting white and not displaying the what would be captured text

#include <Tesseract.au3> #include <MsgBoxConstants.au3> $OCR_Result = _TesseractScreenCapture(0,"",1,1,61,469,833,508,0) MsgBox(0, "OCR", $OCR_Result)
Edited by Melba23
Threads merged

Share this post


Link to post
Share on other sites

awayne,

Please learn to use the "Edit" button - then you do not spam the forum. ;)

BrewManNH,

Sorry, not sure what happened to your post when I merged all those from the OP! :wacko:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

sorry Melba and JohnOne I will for now on hit the edit button. I still cannot figure out why the ocr functionality is not working

:)

Share this post


Link to post
Share on other sites

Need some help working with this.  here is my code:

$firsttext = _TesseractScreenCapture(0, "", 0, 2, $planetleftindent, $planettopindent, $planetrightindent, $planetbottomindent, 1)
MsgBox(0, "Tutorial", $firsttext)

and here is the error message i get.

"C:UsersAndyDropboxStargateTesseract.au3" (185) : ==> Variable must be of type "Object".:
$Obj1.ShowFile ($capture_filename, 1)
$Obj1^ ERROR

Now if i click that it takes me to the udf here :

$Obj1 = ObjCreate("Preview.Preview.1")
        $Obj1_ctrl = GUICtrlCreateObj($Obj1, 0, 0, 640, 480)
        $Obj1.ShowFile ($capture_filename, 1)

I'm guessing it is having trouble creating Preview.Preview but i am not sure.  Can anyone help me with this?  I am very confused why i can't get it running.  Also if i chage the show image to 0, i get no errors but it also returns no text.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

most likely you did not install properly the activex controls needed

$Obj1 = ObjCreate("Preview.Preview.1")

has not returned an object and as such you get an error later when you try to use it as an object

is shimgvw.dll installed on your system?

I think its part of Windows Picture and Fax Viewer and not sure if that is installed nowadays in win7 or win8

Edited by junkew

Share this post


Link to post
Share on other sites

What are the proper activex controls that i need?  Yes i do have that dll installed on my computer.

Share this post


Link to post
Share on other sites

I would say comment this part out in tesseract.au3 as its only showing you the original input which you can easily see thru the windows explorer

#CS
$Obj1 = ObjCreate("Preview.Preview.1")  
$Obj1_ctrl = GUICtrlCreateObj($Obj1, 0, 0, 640, 480)
$Obj1.ShowFile ($capture_filename, 1)
#ce

Share this post


Link to post
Share on other sites

Yes i did try this.  Didn't do anything.

 

 

I would say comment this part out in tesseract.au3 as its only showing you the original input which you can easily see thru the windows explorer

#CS
$Obj1 = ObjCreate("Preview.Preview.1")  
$Obj1_ctrl = GUICtrlCreateObj($Obj1, 0, 0, 640, 480)
$Obj1.ShowFile ($capture_filename, 1)
#ce

 

 

When i did this a box popped up like it was going to show the capture but it doesn't.  I also noticed that i am getting images in my temp folder.  Although it also isn't reading the text.  Not sure if it's because it's red.

Share this post


Link to post
Share on other sites

probably with helpfile GUICtrlCreatePic example 3 you can display the TIFF file in a proper way in that dialogbox.

Tesseract makes a TIFF screenshot first.

but the stuff that needs to be shown on the screen is only helping when tesseract itself is doing the job properly.

But first of all get your tesseract working from the commandline of windows and after that start trying to handle it thru autoit

Share this post


Link to post
Share on other sites

I downloaded the tesseract and run below program without any problems
W7/64 bits
>Running:(3.3.12.0):C:Program Files (x86)AutoIt3autoit3.exe "testme.au3"

#include <C:\Downloads\Tesseract.au3>

$OCR_Result = _TesseractScreenCapture(0,"",1,1,294,121,377,166,0)

;~ MsgBox(0, "Result: ", $OCR_Result)

consolewrite($OCR_Result) 

and the output is not perfect but that can be tuned by learning tesseract with the right languagefiles

 

Pusied 03 Anri2a1A—Il5 u an

 
All,
 
I am lwlshing a problem I am sull nanng last week and
use me Tessevacl unr screencapture function to read
 
The msmn ofTesser3ct I am using can be lmmd hem |
 
mt s,//cnde o la cnml essemcl-ncrldnwnlnadslde
 
om have it panaalry working on Windows 7 here us |
 
In the UDF I had to change Ihe fulluwmg lines
 
CHANGE:
Glubal s|essem:t_1emy_pam
 
 
 
To:
sum: S(dssuvict_Iomp_pdh : “C:Tamp"
AND mam folder Tenn.
 
CHANGE:
SlIellExacmuWlII('C:Pmg:m Files (x3G)Tessem:t |
 
TO:
ShollEmcneWail('C:Pvnqv2m Fvles (xasymssmc: |
 
Iincludn <C:|1a:xlX1nwil‘h|m1oId.lIel nc:..u:>
 
1. 1. 294,121. 317. 166. 0)
 
s0CR_BA5ul: = _Ieuenccsc:eenuncuze(n.'
Hnglnxl?. -nuuu: ". socningsun
 
oonao1ewn:elGOC|1_Re:u1c)
 
>~c:Pzoqram rues (X35)AutoIcSScxTI1AutoIcS’|lravPerAuwIc3|lravDer.exe" /run /prod /lxrorscdaut /Ln '-c:usersuu:.nnocum=u:=u11xr,:::m
~>u. n:5u St-rtizg lntnltlirluasr v 2.1.n.33
>liunn1lI§ AU3CheI:k (:.a.12.u)
o>1::5u:5a mam-ct an-u.xc:o
>Rnnn1lW 3. .12.o):c:P:oq:an rues (x?6YAuI'.o1t3num1I'.3.exe "
,.> was ccuoncqs an Instant or Ctrlolrmk m Slap
 
n:wuu—ne.(I.:ngu-gazuu nymuuznnnans ?5:II.l‘l_7lSe-twin: Puzl 1 cnlzxu cmxn)
 
ix-an Pzaqxnn Fxle: lxE6)luI:nIcCl
 
 
 
1:erslJu1nDo::unenI'.:UIAbe:r,I2e . Au!"

 

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