Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

OCR with MODI

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David de Passos - 01 Sep 2004 18:40 GMT
Hi!

I'm using MODI activex from Microsoft Office 2003 and Microsoft VB.NET to
get the text from an OCR acquired image.

Why after OCR the image, the MODI component rotate the image?

Sometimes the MODI rotates the image 90 degrees and the OCR, obviously, can'
t do its job. Any ideia why this is happening?

There is my code:

Dim miDoc As MODI.Document

Dim miWord() As MODI.Word

Dim strWordInfo As String

Dim i, j As Long

Dim str As String

Dim Cont As Long

Dim IMG As Long

miDoc = New MODI.Document

miDoc.Create("C:\MultiPage.tif")

str = ""

Cont = 0

IMG = miDoc.Images.Count - 1

miDoc.OCR(MiLANGUAGES.miLANG_ENGLISH, True, True)

For j = 0 To IMG

miDoc.Images(j).rotate(0)

For i = 0 To miDoc.Images(j).Layout.Words.count - 1

ReDim Preserve miWord(Cont)

miWord(Cont) = miDoc.Images(j).Layout.Words(i)

Cont += 1

Next

Next

For i = 0 To miWord.Length - 1

str = str & " " & miWord(i).Text

Next

miDoc.Close(False)

miWord = Nothing

Signature

Cumprimentos,
David de Passos
--------------------------------------------------------------
RCSOFT, Lda.
E-Mail: passos@rcsoft.pt
M?vel: +351 966931639
Telefone: +351 239708708
Fax: +351 239708701
Tel. Directo: +351 239708705 ext. 401

Kashif Javed - 10 Sep 2004 17:24 GMT
Try using the following Function to get the text out of an image. Just
pass a file name with full path and it will return the text out of that
file. Its working fine for me without doing anything to the original
image file. I hope it will help.

Public Function fncOCR_Text(ByVal strImagePath As String) As String

'declaring required variables for OCR
     Dim miDoc As MODI.Document
     Dim miLayout As MODI.Layout
     Dim strLayoutInfo As String
     Dim strText As String
     
     'Recognizing the Document
     Set miDoc = New MODI.Document
     miDoc.Create strImagePath
     miDoc.Images(0).OCR
     
     'Storing the value in a variable and returning it
     Set miLayout = miDoc.Images(0).Layout
     strText = Trim(miLayout.Text)
     fncOCR_Text = strText
     
     'Rleasing the Memory
     Set miLayout = Nothing
     Set miDoc = Nothing

End Function

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.