Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Re: Bad OCR results
Started by riggson at 06-19-2008 9:56. Topic has 3 replies.

Print Search « Previous Thread Next Thread »
  06-19-2008, 9:56
riggson is not online. Last active: 5/27/2008 11:23:02 AM riggson

Top 500 Posts
Joined on 05-23-2008
Posts 11
Bad OCR results
Reply Quote
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 is not online. Last active: 5/27/2008 11:23:02 AM riggson

Top 500 Posts
Joined on 05-23-2008
Posts 11
Re: Bad OCR results

Attachment: OcrTest.zip
Reply Quote
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 is not online. Last active: 11/17/2008 11:10:19 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,706
Re: Bad OCR results
Reply Quote
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 is not online. Last active: 5/27/2008 11:23:02 AM riggson

Top 500 Posts
Joined on 05-23-2008
Posts 11
Re: Bad OCR results
Reply Quote
Argh.... that's it.

Thx !!!

   Report 
Post
LEAD Support Fo... » Developer » OCR » Re: Bad OCR results

Powered by Community Server, by Telligent Systems