Welcome to LEAD Support Forum Login | Register | Faq  

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

Re: Searching text
Started by priyanka at 08-11-2008 6:37. Topic has 8 replies.

Print Search « Previous Thread Next Thread »
  08-11-2008, 6:37
priyanka is not online. Last active: 12/18/2008 12:48:12 PM priyanka

Top 50 Posts
Joined on 08-11-2008
Posts 35
Searching text
Reply Quote
i want to search text in ocr  document and highlight the searched word in documents
   Report 
  08-11-2008, 11:00
Yasir Alani is not online. Last active: 11/16/2008 11:29:23 AM Yasir Alani



Top 10 Posts
Joined on 02-05-2007
Posts 311
Re: Searching text
Reply Quote
Please see this post:
http://support.leadtools.com/SupportPortal/cs/forums/2788/ShowPost.aspx#2788

The first demo in that tread is for v14 of our toolkit.

For v15, please scroll down to the last two posts.
Yasir Alani
LEADTOOLS Technical Support
support@leadtools.com
   Report 
  08-12-2008, 2:42
priyanka is not online. Last active: 12/18/2008 12:48:12 PM priyanka

Top 50 Posts
Joined on 08-11-2008
Posts 35
Re: Searching text
Reply Quote
Thank  you

   Report 
  08-12-2008, 6:01
priyanka is not online. Last active: 12/18/2008 12:48:12 PM priyanka

Top 50 Posts
Joined on 08-11-2008
Posts 35
Re: Searching text
Reply Quote
ha I want top rovide option for searching on various file and on searching a,serch word should be highlighted in multiple document.... a file can have more than one pages,

   Report 
  08-12-2008, 10:26
Yasir Alani is not online. Last active: 11/16/2008 11:29:23 AM Yasir Alani



Top 10 Posts
Joined on 02-05-2007
Posts 311
Re: Searching text
Reply Quote
Our toolkit can perform OCR on multiple pages, but you must load these pages and treat each of them individually. We don't have a demo that does highlighting in multiple pages at once, but you should be able to modify the demo to OCR multiple pages and multiple files if you want. The attachments in the forum I gave you contain complete source code.


Yasir Alani
LEADTOOLS Technical Support
support@leadtools.com
   Report 
  08-13-2008, 5:32
priyanka is not online. Last active: 12/18/2008 12:48:12 PM priyanka

Top 50 Posts
Joined on 08-11-2008
Posts 35
Re: Searching text
Reply Quote

Hi

Actully have you seen Ebook functionality in google,i want to search according to that,first i have to search the document having that word and hightlight that word .I can Scan multple docuement  page and able to OCR also on that ans storing after ocr as .txt,doc and .rdf,so issue is that in the searched document there can be multiple page and how i can provide highlighting facility and then showing that document,i can try to OCR each page and after recognizing i want the image to be displayed on RoasterTumnailBrowser ,having hightlight on page and continued for other pages.

 

Attaching code on which i am working

Dim FileName As String = "C:\Documents and Settings\priyanka\Desktop\manoj\MultiplePageScan1\All.tif"

RasterCodecs.Startup()

Dim codecs As RasterCodecs

'Dim image As RasterImage

codecs = New RasterCodecs()

RasterImageViewer1.Image = codecs.Load(FileName)

'image = codecs.Load("E:\My Document\icon\ph\photo\scan0003.bmp")

'image = codecs.Load("C:\Documents and Settings\priyanka\Desktop\manoj\MultiplePageScan1\All.tif")

' Unlock support for the OCR engine

RasterSupport.Unlock(RasterSupportType.Ocr, "TestKey")

rasterDoc.RecognitionDataFileName = "c:\testrdf.rdf"

' Delete the RDF if it already exists

If File.Exists(rasterDoc.RecognitionDataFileName) Then

File.Delete(rasterDoc.RecognitionDataFileName)

Else

' Do nothing

End If

Dim k As Integer

Dim info As CodecsImageInfo = codecs.GetInformation(FileName, True)

For k = 1 To info.TotalPages

Dim image As RasterImage = codecs.Load(FileName, 0, CodecsLoadByteOrder.BgrOrGray, k, k)

rasterDoc.SpellLanguageId = RasterDocumentLanguage.English

rasterDoc.EnableSubsystem = True

rasterDoc.EnableCorrection = True

RasterImageViewer1.Image = codecs.Load(FileName)

rasterDoc.AddPage(image, 0)

annContainerObj = New AnnContainer

annContainerObj.Bounds = New AnnRectangle(0, 0, RasterImageViewer1.ImageSize.Width, RasterImageViewer1.ImageSize.Height, AnnUnit.Pixel)

annContainerObj.Name = "Container"

annContainerObj.Visible = True

annContainerObj.UnitConverter = New AnnUnitConverter(96, 96)

rasterDoc.AddPage(image, 0)

' Specifies the name of the file that will be used in the recognition.

rasterDoc.Recognize(0, 1, Nothing)

'Dim recogWords As IList(Of RasterDocumentRecognizedWords) = rasterDocument.GetRecognizedWords(0)

Dim recogWords As IList = rasterDoc.GetRecognizedWords(0)

Dim i As Integer

Dim count As Integer

count = 0

' Get word to locate

Dim word_to_find As String = InputBox("Enter the word you would like to find and highlight", "Enter Word")

' Loop through all of the recognized words, get the coordinates

' and place an annotation there

For i = 0 To recogWords.Count - 1

If recogWords(i).Word = word_to_find Then

count = count + 1

End If

Next

If count = 0 Then

MessageBox.Show(word_to_find & " was not found")

Else

MessageBox.Show(word_to_find & " was found " & count.ToString & " times")

Dim highlights(count) As AnnHiliteObject

For i = 0 To count

highlights(i) = New AnnHiliteObject

Next

count = 0

'Dim image1 As RasterImage

For i = 0 To recogWords.Count - 1

If recogWords(i).Word = word_to_find Then

highlights(count).Bounds = New AnnRectangle(recogWords(i).WordArea.Left, recogWords(i).WordArea.Top, recogWords(i).WordArea.Width, recogWords(i).WordArea.Height, AnnUnit.Pixel)

highlights(count).HiliteColor = Color.Yellow

annContainerObj.Objects.Add(highlights(count))

RasterImageViewer1.Refresh()

count = count + 1

End If

Next

End If

Next

Dim image1 As RasterImage = RasterImageViewer1.Image

Dim imageFileName As String = "Page" & k & ""

Dim item As RasterImageListItem = New RasterImageListItem(image1, k, imageFileName)

'Dim item As RasterImageListItem = New RasterImageListItem(image1, k, imageFileName)

'Select the first item

'If i = 0 Then

item.Selected = True

'End If

' Add the item to the image list

'Next

RasterThumbnailBrowser1.Items.Add(item)


   Report 
  08-13-2008, 10:58
Yasir Alani is not online. Last active: 11/16/2008 11:29:23 AM Yasir Alani



Top 10 Posts
Joined on 02-05-2007
Posts 311
Re: Searching text
Reply Quote
I'm afraid I'm not familiar with Ebook.

This first part (searching a document then highlighting a word) can be done using the demo I directed you to. You should then implement the same code to do the same function for multiple images.

Our OCR functions support saving to TXT, RTF and DOC. So, once recognition is complete, you can save files in the desired format. Saving certain pages of a document is also possible.

If you want to save a page that only contains a certain word (the highlighted word), then search the document for the word, and using the members of the RasterDocumentRecognizedWords class you can find where the word is found (page, area, and zone), and then save the page in question.


Yasir Alani
LEADTOOLS Technical Support
support@leadtools.com
   Report 
  08-16-2008, 4:14
priyanka is not online. Last active: 12/18/2008 12:48:12 PM priyanka

Top 50 Posts
Joined on 08-11-2008
Posts 35
Re: Searching text
Reply Quote
Hi i Can Highlight on multiple document ,but can you tell me i need to provide next and previous button option so in same page i can direct user to next highlighted word and how  image that is dispalying in roasterimageviewer ,option on right clicking i can copy that text
   Report 
  08-17-2008, 11:35
Yasir Alani is not online. Last active: 11/16/2008 11:29:23 AM Yasir Alani



Top 10 Posts
Joined on 02-05-2007
Posts 311
Re: Searching text
Reply Quote
If you want to implement a certain action on the mouse right-click, and you are using our .NET 15 RasterImageViewer control, you can use the RasterImageViewer.OnMouseDown event handler to do that.

About moving between highlighted words, you will have to write code to implement such a feature, because it's not part of our toolkit.
Yasir Alani
LEADTOOLS Technical Support
support@leadtools.com
   Report 
Post
LEAD Support Fo... » General » Feature Request... » Re: Searching text

Powered by Community Server, by Telligent Systems