Re: Bad OCR results
Started by riggson at 06-19-2008 9:56. Topic has 3 replies.
|
|
06-19-2008, 9:56
|
riggson
Joined on 05-23-2008
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
|
|
|
|
|
Report
|
|
|
|
06-20-2008, 9:25
|
riggson
Joined on 05-23-2008
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
|
|
|
|
|
Report
|
|
|
|
06-20-2008, 10:55
|
GregR

Joined on 05-31-2006
In House
Posts 1,607
|
|
|
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.
Greg Ross LEADTOOLS Technical Support
|
|
|
|
|
Report
|
|
|
|
06-23-2008, 1:46
|
riggson
Joined on 05-23-2008
Posts 11
|
|
|
Argh.... that's it.
Thx !!!
|
|
|
|
|
Report
|
|
|
|
|
LEAD Support Fo... » Developer » OCR » Re: Bad OCR results
|
|
Copyright LEAD Technologies, Inc. 2008
