簡體   English   中英

在 x86 平台上使用 emgu cv 時無法加載 dll cvextern

[英]unable to load dll cvextern while using emgu cv for x86 platform

需求:將C# DLL(使用Emgu.CV.World.dll進行圖像比較)加載到python項目中,並使用一些參數調用DLL內部的函數。

我嘗試使用 Emgu.CV.World.dll 導出 DLL 以進行圖像比較。 在為“任何 CPU”目標編譯時,DLL 導出不起作用。 更改為x86平台后,DLL從Python正確加載:

mydll = ctypes.cdll.LoadLibrary(self.libPath)

但是在 DLL 中調用函數時:

ImageContentComparisonResult = mydll.CompareImageContent(self.OutputFile, self.OriginalFile)

拋出以下異常:

 WindowsError: [Error -532462766] Windows Error 0xE0434352

Visual Studio 的輸出:

 A first chance exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.

在此之后,創建了一個示例 Emgu.CV 項目(GUI),得到了同樣的異常。 在那里我得到了異常詳細信息,例如

{"The type initializer for 'Emgu.CV.CvInvoke' threw an exception."} InnerException: {"Unable to load DLL 'cvextern': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"}

將 Emgu.CV 的 x86 和 x64 DLL 復制到“bin\\x86\\Debug”后,它適用於示例應用程序,但對於非 GUI C# 項目,即使復制所需的 DLL 后它也無法工作。

將libs從\\libs\\x64復制到我的是:C:\\Emgu\\emgucv-windesktop_x64-cuda 3.3.0.2826\\libs\\x64

C# DLL 不會使用 ctypes 加載。 需要使用 python 包中包含的 clr.AddReference 方法。 如果使用 python 2.7,則需要卸載作為 2.7 安裝一部分的 clr 包(這是為了避免命名空間沖突)。 或者 IronPython 也可以用於相同的目的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM