Ocr not working

I keep getting an object variable or with block....... error when calling ocr.process.

I've modified the demo a bit as it's not valid code.

Can you please tell me what I'm missing....



Private Sub Button7_Click(sender As System.Object, e As System.EventArgs) Handles Button7.Click


' resource file

Const resourceFileName As String = "e:\2011.07.02 v1.0 Aspose.OCR.Resouces.zip"

' image document on which OCR is to be performed

Dim imageFile As String = "e:\wordtest.tiff"


Console.WriteLine("Performing OCR on " & imageFile & "....")


' Initialize OcrEngine

Dim ocr As Aspose.OCR.OcrEngine = New Aspose.OCR.OcrEngine()

' Set the image


Dim iom As New IO.MemoryStream(IO.File.ReadAllBytes(imageFile))

iom.Position = 0


ocr.Image = Aspose.OCR.ImageStream.FromMemoryStream(iom, Aspose.OCR.ImageStreamFormat.Tiff)

' Add language

ocr.Languages.AddLanguage(Aspose.OCR.Language.Load("english"))

ocr.Config.NeedRotationCorrection = False

ocr.Config.UseDefaultDictionaries = True

'ocr.Config.di


' Load the resource file

ocr.Resource = New System.IO.FileStream(resourceFileName, System.IO.FileMode.Open)

Try

' Process the whole image

If ocr.Process() Then

' Get the complete recognized text found from the image

Console.WriteLine("Text recognized./n" + ocr.Text.ToString)

End If

Catch ex As Exception

Console.WriteLine("Exception: " & ex.Message)

End Try


End Sub

Hi Nanno,

Sorry for replying late.

There was a problem in the resource file uploaded earlier. Apologies for the inconvenience. The valid resource file has been uploaded and you can download this file here:
http://www.aspose.com/community/files/51/.net-components/aspose.ocr_for_.net/category1404.aspx

This will hopefully solve your issue.

Many Thanks

I'm sorry to say it didn't. The error is not thrown but the ocr.proces is called and it doesn't return with a valid value. After about 5 minutes I've killed the process.

Any ideas?

Yours Nanno

Dear Nanno,

We are extremely sorry for the inconvenience.

Can you please attach the source image for analysis?

Best Regards,

do you have a e-mail adres where I can sent the files to as the contain data which I cannot post on a public forum.

never mind. Please check you’re private email

Dear Nanno,

I was able to extract text from your files but the accuracy of the text was less than 80% because 16pt and 32pt +/- 20% font sizes are supported at the moment and the text size in your images is smaller than that. This issue has been logged into our issue tracking system as <!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>AR-SA</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:Arial; mso-bidi-theme-font:minor-bidi;}

<![endif]–><span style=“font-size:13.5pt;font-family:“Arial”,“sans-serif”;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:
EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>OCR-29048
. We will keep you updated on this issue in this thread.

Time spent in processing your files was just over 5 minutes. Our developers are working on performance of the product and OCR speed will be improved in the coming releases.

We are sorry for the inconvenience.

Please feel free to contact us in case you have further comments or questions.

Best Regards,

Ok, thank you for the feedback.

All the documents we want to recognize have that type of fontsize. 16pt is pretty large for a business document in Europe :-).

5 Minutes is way too long. Our current engine will only take 1 to 2 seconds per page. That's what you're aming for....

Yours, Nanno

Hi Nanno,

Of course, smaller fonts should be recognized and our developers are working on this feature. Regarding performance, our ultimate goal is to provide faster speed than any other component but the performance of Aspose.OCR for .NET will be improved gradually.

Please feel free to contact us in case you have further comments or questions.

Best Regards,

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.