0

我有以下代码:

    ddlResultFormat.Items.Add("Text")

    dynamicDotNetTwain1.LoadImage("C:\Users\elj\Desktop\3b072e9b-76b4-4776-bd3c-5984074d8ecd.png")
    Dim r = dynamicDotNetTwain1.GetImage(dynamicDotNetTwain1.CurrentImageIndexInBuffer).Width.ToString()
    Dim l = dynamicDotNetTwain1.GetImage(dynamicDotNetTwain1.CurrentImageIndexInBuffer).Height.ToString()
    Dim languageFolder As String
    languageFolder = "C:\Program Files (x86)\Dynamsoft\Dynamic .NET TWAIN 5.2 Trial\Samples\Bin\"
    Dim languages As New Dictionary(Of String, String)
    languages.Add("English", "eng")
    Me.dynamicDotNetTwain1.OCRTessDataPath = languageFolder
    Me.dynamicDotNetTwain1.OCRLanguage = "English"

    Dim ocrResultFormat As Dynamsoft.DotNet.TWAIN.OCR.ResultFormat
    ocrResultFormat = CType(System.Enum.Parse(GetType(Dynamsoft.DotNet.TWAIN.OCR.ResultFormat), Val("&H" & 0)), Dynamsoft.DotNet.TWAIN.OCR.ResultFormat)
    Me.dynamicDotNetTwain1.OCRResultFormat = ResultFormat.Text

    Dim strDllPath As String
    strDllPath = "C:\Program Files (x86)\Dynamsoft\Dynamic .NET TWAIN 5.2 Trial\Redistributable\OCRResources\"
    dynamicDotNetTwain1.OCRDllPath = strDllPath

    If (Me.dynamicDotNetTwain1.CurrentImageIndexInBuffer < 0) Then
        Dim jajajja = "Please load an image before doing OCR!"
    End If

    Dim sbytes As Byte()
    sbytes = Me.dynamicDotNetTwain1.OCR(Me.dynamicDotNetTwain1.CurrentSelectedImageIndicesInBuffer)

我面临的问题是sbytes字节数​​组总是被设置为空,尽管缓冲区中的索引是正确的,并且路径和 dll 实现得很好,但是转换为字节数组没有成功,我没有得到任何异常,但字节的长度为 0

知道如何解决这个问题吗?

4

1 回答 1

0

请更新以下代码行,然后重试。

Me.dynamicDotNetTwain1.OCRLanguage = "eng" 'not English
于 2014-07-09T06:14:43.410 回答