2012-08-22 116 views
0

文本我試圖通過Aspose.OCR來提取圖像的文字,
我的代碼:
vb.net Aspose.OCR - 提取從圖像

Const resourceFileName As String = "c:\2011.08.05 v1.1 Aspose.OCR.Resouces.zip" 
     Dim uploadedImage As String = "c:\ConvertMeToText.bmp" 
     Try 
      'Create OcrEngine instance and assign 
      'image, language and image configuration 
      Dim ocr As New OcrEngine() 
      ocr.Image = ImageStream.FromFile(uploadedImage) 

      ocr.Languages.AddLanguage(Language.Load("english")) 
      ocr.Config.NeedRotationCorrection = True 
      ocr.Config.UseDefaultDictionaries = True 
      Dim fileStream As New FileStream(resourceFileName, FileMode.Open) 
      ocr.Resource = fileStream 
      Try 
       If ocr.Process() Then 
        TextBox1.Text = ocr.Text.ToString() 
       End If 
      Catch ex As Exception 
       MsgBox("Exception: " & ex.Message) 
      End Try 
      fileStream.Close() 
      ocr = Nothing 
     Catch ex As Exception 
      MsgBox("Exception: " & ex.Message) 
     End Try 


例外: ZipEntry的:: ReadHeader() :錯誤簽名(0x00000100)在位置0x00000000

回答

1

我的名字是Nayyer,我在Aspose擔任支持開發人員/技術推廣人員。

從異常,它看起來像Aspose.OCR版本和資源文件版本有一些區別。每個Aspose.OCR版本都使用單獨的resources.zip文件,如果您嘗試將Aspose.OCR v1.0.0與2011.08.05 v1.1 Aspose.OCR.Resouces.zip一起使用,那麼您可能會得到類似的異常。可能是您可以嘗試Aspose.OCR v.1.1.0的最新版本,其兼容資源文件可通過this link獲取。