Jump to content

OCR help


Recommended Posts

Odd. Installed it, Says the object doesnt exist.

EDIT::

Appears, All there is in that is a helpfile, A html page. and a messagebox that says "LULULULINSTALLED".

EDIT:::

"Important The MODI programmability features that are described in this document are available only in Microsoft® Office Document Imaging 2003. The Microsoft® Office XP version of Document Imaging did not include a progammable object model."

Edited by AzKay
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

hello there, i'm trying the ocr script as well and i've found a problem that i'm not able to avoid

If the captured part of the screen doesn't contain any text to ocr, the script stops himself with an error.

C:\Programmi\AutoIt3\Examples\OCR SCRIPT.au3 (52) : ==> The requested action with this object has failed.:

$oDoc.Ocr(16, True, False)

$oDoc.Ocr(16, True, False)^ ERROR

>Exit code: 1 Time: 24.917

this is the code that i'm using

#include <ScreenCapture.au3>

while 1
   FileInstall( "c:\programmi\MiniCap\MiniCap.exe", @SYSTEMDIR & "\" )
    $sTargetImage = "D:\programmi\ocrtesto.gif"
    $sTargetTitle = "Last Land"
    WinWaitActive( $sTargetTitle )
    sleep (100)
;Capture the target by position
    $aPos = WinGetPos( $sTargetTitle )
    $sSwitches = ' -save "' & $sTargetImage & '"'
    $sSwitches &= ' -captureregion ' & 310 & ' ' & 640 & ' ' & 634 & ' ' & 683
    $sSwitches &= ' -exit'
    RunWait( @COMSPEC & ' /c minicap.exe ' & $sSwitches, "", @SW_HIDE)  
    
    
;image magick part
$oMagic = ObjCreate("ImageMagickObject.MagickImage.1")  
    
$ret = $oMagic.Convert("d:\programmi\ocrtesto.gif", _
    "-black-threshold", "88%", "d:\programmi\ocrtesto1.gif")
    sleep (1000)

;~ $img = ObjCreate("ImageMagickObject.MagickImage.1")
;~ $ret = $img.Convert("d:\programmi\ocrtesto.gif", _
;~       "-resize", "1024x768", _
;~       "d:\programmi\last land\ocrtestonew.gif")
;~      
;~ $sTargetImage = "d:\programmi\ocrtestonew.gif"  ;immagine da scansionare ingrandita
;~ $sTargetImage1 = "d:\programmi\ocrtesto.gif"  ;immagine da scansionare originale
;WinWaitActive( "Gimp" )
  $sTargetImage = "D:\programmi\ocrtesto1.gif"

$sTargetText = _OCRGetText( $sTargetImage )
tooltip ($sTargetText, 0, 900)
;Display the results
;Msgbox( 0, @SCRIPTNAME, "Results of OCR:" & @LF & $sTargetText )


If StringInStr($sTargetText, "built in") Then 
    sleep (2000)
    Send("{ENTER}Salve{ENTER}")   ;check if the built in words are in the image
EndIf
WEnd

Func _OCRGetText( $Image )
Local $oDoc = ObjCreate("MODI.Document")
    $oDoc.Create($Image)
    If @ERROR Then Return SetError(1)
    $oDoc.Ocr(9, True, False)       ;ENGLISH = 9
   If @ERROR Then Return SetError(2)
    Return $oDoc.Images(0).Layout.Text
    $oDoc = 0
EndFunc
Link to comment
Share on other sites

hello there, i'm trying the ocr script as well and i've found a problem that i'm not able to avoid

If the captured part of the screen doesn't contain any text to ocr, the script stops himself with an error.

C:\Programmi\AutoIt3\Examples\OCR SCRIPT.au3 (52) : ==> The requested action with this object has failed.:

$oDoc.Ocr(16, True, False)

$oDoc.Ocr(16, True, False)^ ERROR

>Exit code: 1 Time: 24.917

Can you upload your image ?

Link to comment
Share on other sites

Hello, as i've got to screenshot small part of screen in order to OCR that part of the screen MODI returns ERROR ( the image is too small to be recognized).

So what i would like to do is to screenshot part of the screen, and paste the screenshot in a bigger image on disk and ask MODI to recognize the new created picture.

My problem is that i have no API to modify a .TIFF image by "inserting" my screenshot and saving the result.

Does anybody knows how to do that ?

Thanks for your precious help.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...