|
hi tried everything but it si not working i am sending a function i have created for storing the image in vb.net window application after highlighthing and as you said after saving try to open it in your webimageviewer
Public Sub DispayImage()
Dim temp As String = "D:\MyWork\popo.txt"
If Not temp = "" Then
System.IO.File.Delete(temp)
End If
RasterCodecs.Startup()
Dim FileName As String = "D:\MyImage.jpg "
RasterImageViewer1.Refresh()
Dim images As New RasterImage(RasterImageViewer1.Image)
codecs = New RasterCodecs
codecs.Save(images, FileName, RasterImageFormat.Tif, 24, 1, -1, 1, CodecsSavePageMode.Insert)
Dim viewer As RasterImageViewer = New RasterImageViewer()
viewer.Image = codecs.Load(FileName)
annContainerObj = New AnnContainer
annContainerObj.Bounds = New AnnRectangle(0, 0, viewer.ImageSize.Width, viewer.ImageSize.Height, AnnUnit.Pixel)
annContainerObj.Name = "Container"
annContainerObj.Visible = True
annContainerObj.UnitConverter = New AnnUnitConverter(96, 96)
documentEngine.AddPage(viewer.Image, 0)
documentEngine.RecognitionDataFileName = temp
ocumentEngine.EnableSubsystem = True
documentEngine.EnableCorrection = True
documentEngine.Recognize(0, 1, Nothing)
Dim recogWords As IList = documentEngine.GetRecognizedWords(0)
Dim i As Integer
Dim count As Integer
count = 0
' Get word to locate
Dim word_to_find As String
If word_to_find = "" Then
word_to_find = Searchtxt.Text.ToLower.Trim()
End If
' Loop through all of the recognized words, get the coordinates
' and place an annotation there
Dim str As String
For i = 0 To recogWords.Count - 1
str = recogWords(i).Word
If str.ToLower.Contains(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
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))
viewer.Refresh()
count = count + 1
End If
Next
End If
viewer.Refresh()
Dim objSaver As New ImageFileSaver
objSaver.Save( Me, codecs, viewer.Image)
'automation.Container.Objects.Add(manager.AnnContainer)
but the images is not showing the highlighted word after saving ,,,,,,,,,,,as you said to create window application for that.......
|