Emgu CV 无法加载 DLL 'cvextern'

问题描述 投票:0回答:1

我一直在尝试在我的 C# 项目中设置 EmguCV,但我陷入了困境。我已经安装了 EmguCV,下载了 OpenCV 并将 bin 文件夹设置为 PATH。我已经写了最基本的代码行:

using System;
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;

string filepath = "...\\folder\\test.png";
Mat image = new Mat(filepath, ImreadModes.Color);
//some checks on this working out as expected

当我努力构建项目时,我收到以下信息:

Exception has occurred: CLR/System.TypeInitializationException
An unhandled exception of type 'System.TypeInitializationException' occurred in Emgu.CV.dll: 'The type initializer for 'Emgu.CV.MatInvoke' threw an exception.'
 Inner exceptions found, see $exception in variables window for more details.
 Innermost exception     System.DllNotFoundException : Unable to load DLL 'cvextern' or one of its dependencies: The specified module could not be found. (0x8007007E)
<Cannot evaluate the exception stack trace>

我该如何解决这个问题?据我了解,问题在于 cvextern.dll 不在我在 PATH 中设置的 bin 文件夹中。但我从他们的网站下载了 opencv 所以我怀疑它的版本也是错误的。

我正在使用 Visual Studio Code。

c# opencv emgucv
1个回答
0
投票

正如评论中提到的,我只需要运行

dotnet add package Emgu.CV.runtime.{etc}
© www.soinside.com 2019 - 2024. All rights reserved.