Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, October 27, 2004 11:42:11 PM(UTC)

Groups: Registered
Posts: 1

Hi. Hit a problem with the method: rasterOCR.GetRecognizedCharacters(0)

It keeps telling me at the line in bold that “Object reference not set to an instance of an object.“

Can anyone help me please? Thanks!

Dim codecs As Codecs.RasterCodecs = New Codecs.RasterCodecs
Dim myImage As IRasterImage
Dim info As CodecsImageInfo
Dim oFile As System.IO.File
Dim oRead As System.IO.StreamReader

oRead = oFile.OpenText(fileName)
codecs.CodecsPath = "C:\Inetpub\wwwroot\OCRService\bin"
info = codecs.GetInformation(oRead.BaseStream,
myImage = codecs.Load(oRead.BaseStream, 0, CodecsLoadByteOrder.RgbOrGray, 1, -1)

Dim rasterOCR As Ocr.RasterOcr = New Ocr.RasterOcr


rasterOCR.SpellLanguageID = Leadtools.Ocr.RasterOcrLanguage.English
rasterOCR.RecognitionDataFileName = "C:\Inetpub\wwwroot\OCRService\bin\testX.rdf"

Dim CodecsCommand As Codecs.RasterCodecs = New Codecs.RasterCodecs
Dim rasterPageCount As Integer
rasterPageCount = myImage.PageCount

Dim isLocked As Boolean
isLocked = RasterSupport.IsLocked(RasterSupportType.Ocr)
rasterOCR.AddPage(myImage, -1)

Dim pageCount As Integer
pageCount = rasterOCR.PageCount


'auto locate zone
rasterOCR.ZoneParser = Leadtools.Ocr.RasterOcrPageParser.Auto

Dim zoneCount0 As Integer
zoneCount0 = rasterOCR.GetZonesCount(0)
rasterOCR.Recognize(0, 1)

Dim i As Integer
Dim myString As String
Dim recognizedChars() As Ocr.RasterOcrRecognizedCharacters
recognizedChars = rasterOCR.GetRecognizedCharacters(0)


Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, July 18, 2005 10:19:32 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

I checked the code in a small VB.Net v14 project and its working fine.
Try the latest .Net patches, which you can get by sending your toolkit serial number to our support email address (don't post it here).
The build version of the LEADTOOLS .Net DLLs is
I am attaching the VB.NET project that I used in testing.

Maen Badwan
LEADTOOLS Technical Support
File Attachment(s):
VB NET OCR v14.zip (9kb) downloaded 47 time(s).

Edited by moderator Thursday, April 6, 2017 3:39:51 PM(UTC)  | Reason: Not specified

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2023, Yet Another Forum.NET
This page was generated in 0.079 seconds.