I need really really simple OCR to read bold very large verdana alphanumeric codes such as "L2C" or "GX45". When I try to run it as shown on one of the many sites google brought me to, it failed. I played around with the midoc.images(0).ocr, removing the .ocr method, changing the subscript to 1 and negative 1, etc but those just got me invalid procedure calls for my time. The image format is a JPEG, but I can use practically any image format as irfanview will convert via command-line and does so very fast. However, at the moment, neither JPEG or BMP are working, both throw this error:
Method of OCR object IImage failed.
here is the code I used:
Code:
Public Function OCRtest(strTempImg)
pXname = "ocrTest"
'On Error GoTo err_hand
Dim miDoc As Object
Dim miWord As MODI.Word
Dim strWordInfo As String
Set miDoc = CreateObject("MODI.Document")
miDoc.Create strTempImg
' Perform OCR.
miDoc.Images(0).ocr
' Retrieve and display word information.
Set miWord = miDoc.Images(0).Layout.Words(2)
strWordInfo = _
"Id: " & miWord.ID & vbCrLf & _
"Line Id: " & miWord.LineId & vbCrLf & _
"Region Id: " & miWord.RegionId & vbCrLf & _
"Font Id: " & miWord.FontId & vbCrLf & _
"Recognition confidence: " & _
miWord.RecognitionConfidence & vbCrLf & _
"Text: " & miWord.Text
Set miWord = Nothing
Set miDoc = Nothing
OCRtest = strWordInfo
Return
Exit Function
err_hand:
Call CStatus(Error, 504, Err.Number, Err.description, strTempImg)
End Function