Method no found

Discussions about machine vision support in GdPicture.
Post Reply
Magc
Posts: 6
Joined: Thu Aug 15, 2013 4:55 pm

Method no found

Post by Magc » Thu Aug 15, 2013 6:16 pm

Hi,

I have the next example code:

Code: Select all

      Dim oGdPictureImaging As New GdPicture9.GdPictureImaging
        oGdPictureImaging.SetLicenseNumber("license demo") 'Replace XXXX by a valid or commercial KEY
        oGdPictureImaging.SetLicenseNumberOCRTesseract("license demo") 'Replace XXXX by a valid or commercial KEY


        Dim sOCR As String
        Dim hFile As Integer
        Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("")
        Dim PageCount As Integer = 1


        If oGdPictureImaging.GetStat = GdPictureStatus.OK Then
            If oGdPictureImaging.TiffIsMultiPage(ImageID) Then
                PageCount = oGdPictureImaging.TiffGetPageCount(ImageID)
            End If

            If Dir(My.Application.Info.DirectoryPath & "\ocr.txt") <> "" Then Kill((My.Application.Info.DirectoryPath & "\ocr.txt"))
            hFile = FreeFile()
            FileOpen(hFile, My.Application.Info.DirectoryPath & "\ocr.txt", OpenMode.Append)


            For I As Integer = 1 To PageCount
                If I > 1 Then
                    oGdPictureImaging.TiffSelectPage(ImageID, I)
                End If
                oGdPictureImaging.OCRTesseractReinit()
                sOCR = oGdPictureImaging.OCRTesseractDoOCR(ImageID, TesseractDictionary.TesseractDictionaryEnglish, "C:\Program Files\GdPicture.NET\Redist\Commons\OCR", "")
                If oGdPictureImaging.GetStat <> GdPictureStatus.OK Then
                    MsgBox("Error on page " + Str(I) + ": " + oGdPictureImaging.GetStat.ToString)
                End If
                oGdPictureImaging.OCRTesseractClear()
                PrintLine(hFile, "OCR Page " + Str(I))
                PrintLine(hFile, "-------------------------------------------------------------------")
                PrintLine(hFile, sOCR)
            Next I

            FileClose(hFile)
            oGdPictureImaging.ReleaseGdPictureImage(ImageID)

            Call ShellExecute(Me.Handle.ToInt32, vbNullString, My.Application.Info.DirectoryPath & "\ocr.txt", "", "", 1)
        Else
            MsgBox("Can't open selected file !")
        End If
but, in the lines

Code: Select all

oGdPictureImaging.SetLicenseNumberOCRTesseract("license demo") 'Replace XXXX by a valid or commercial KEY
and

Code: Select all

sOCR = oGdPictureImaging.OCRTesseractDoOCR(ImageID, TesseractDictionary.TesseractDictionaryEnglish, "C:\Program Files\GdPicture.NET\Redist\Commons\OCR", "")
send me errors, in the first "SetLicenseNumberOCRTesseract is not a member of oGdPictureImaging", and the second "TesseractDictionary.TesseractDictionaryEnglish is not defined"

I added GdPicture.NET.9 reference and Import GdPicture9 and GdPictureOCR namespace

what I am missing?

Thanks

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Method no found

Post by SamiKharma » Fri Aug 16, 2013 5:43 pm

Hi,

Please do have a look at the OCR sample in the samples folder of V9, as it addresses both issues:

1. The SetLicenseNumberOCRTesseract does not exist anymore. The unlocking of the toolkit has changed, you can see an example in the sample demo, and here is the documentation for it:
https://www.gdpicture.com/guides/gdpicture/v9/html/con ... NET__.html

2. That is not the appropriate call for the OCRTesseractDoOCR function, please do have a look at the OCR demo which will show you how to call the parameters.

Best,
Sami

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests