This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Thursday, June 19, 2008 4:51:16 AM(UTC)
Groups: Registered
Posts: 11
Hi!
I have some problems by implementing the OCR Engine. If I use the VBOcrDemo to recognize a zone on an image I've got good results. But if I try to do the same (with the same image) in my application the result is not the same. I use the following code:
---
Dim rDoc As RasterDocumentEngine
rDoc = RasterDocumentEngine.Instance
rDoc.Startup()
rDoc.SpellLanguageId = RasterDocumentLanguage.German
rDoc.RecognitionDataFileName = "c:\test.rdf"
Dim zone As RasterDocumentZoneData = New RasterDocumentZoneData
Dim rc As System.Drawing.Rectangle
rc = New System.Drawing.Rectangle(0, 0, Math.Min(800, img.Width), Math.Min(200, img.Height))
zone.Rectangle = rc
zone.RecognizeModule = RasterDocumentRecognizeModule.Auto
zone.FillMethod = RasterDocumentFillMethod.Default
zone.CharacterFilter = RasterDocumentCharacterFilter.Alpha And RasterDocumentCharacterFilter.Digit
zone.Type = RasterDocumentZoneType.HorizontalText
rDoc.AddPage(imgTmp, -1)
rDoc.ActivePage = rDoc.PageCount - 1
rDoc.AddZone(rDoc.ActivePage, -1, zone)
rDoc.Recognize(rDoc.ActivePage, 1, Nothing)
Dim recogWords As IList(Of RasterDocumentRecognizedWords)
recogWords = rDoc.GetRecognizedWords(rDoc.ActivePage)
---
There is one main difference to the demo project. I am not using the image at the RasterImageViewer. I create a copy of the image with the cloneAll function instead. What is wrong with my code???
Riggson
#2
Posted
:
Friday, June 20, 2008 4:20:08 AM(UTC)
Groups: Registered
Posts: 11
Hi again.
I ve made a small exsample with an image included which will show the problem. The VbOcrDemo recognizes the image perfect. But my code does not. Maybe you can help me...
Riggson
#3
Posted
:
Friday, June 20, 2008 5:50:06 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 764
First, if you want to combine two flags together, you OR them, not AND them. Since they are bitwise values, when you AND them together, it becomes 0. Even if you had used OR correctly, a zone can only have one CharacterFilter. Therefore, I just changed it to RasterDocumentCharacterFilter.Default.
I don't know what other options you set in the OCR demo, but I know that the Recognize dialog defaults to setting EnableCorrection and EnableSubsystem to false, while in your demo they are set to true. When I set these to false along with only using the Default CharacterFilter, your project gave me the same results as the demo.
#4
Posted
:
Sunday, June 22, 2008 8:41:18 PM(UTC)
Groups: Registered
Posts: 11
Argh.... that's it.
Thx !!!
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.