EmguCV 64 位构建运行时错误

发布于 2024-12-12 10:08:43 字数 599 浏览 0 评论 0原文

我在 W7/x64 操作系统上使用 .net 4.0 和 VS2010 将现有 32 位 EmguCV(版本 2.3)构建为 64 位时遇到问题。我已经购买了商业许可证(如果重要)并从收据中提供的链接下载。

错误是

System.TypeInitializationException was unhandled
 Message=The type initializer for 'Emgu.CV.CvInvoke' threw an exception.
 Source=Emgu.CV
 TypeName=Emgu.CV.CvInvoke

我按照本文中提供的说明进行操作。事实上,我使用了本文中的示例项目,它们使用 V2.2 构建得很好,但是当我替换为 V2.3 二进制文件(emgu 和 opencv)时,遇到了错误。

有人成功构建了 Emgu(版本 2.3.x)x64 项目吗?请提供一些指导。

I am running into issues building an existing 32-bit EmguCV (Version 2.3) into 64-bit using .net 4.0 and VS2010 on a W7/x64 OS. I have purchased a commercial license, if that matters and downloaded from the links provided in the receipt.

The error is

System.TypeInitializationException was unhandled
 Message=The type initializer for 'Emgu.CV.CvInvoke' threw an exception.
 Source=Emgu.CV
 TypeName=Emgu.CV.CvInvoke

I followed the instructions provided in this article. In fact I used the samples projects in the article and they build fine with V2.2, but when I replace with V2.3 binaries (both emgu and opencv), run into the error.

Has anyone successfully built an Emgu (Version 2.3.x) x64 project? Please provide some guidance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

日记撕了你也走了 2024-12-19 10:08:43

此错误的原因(如果其他人遇到同样的问题)是程序无法访问 opencv_imgproc231.dll 或 opencv_core231.dll,即使它们存在于输出“bin”目录中。

有两种解决方案:

  1. 将它们添加到项目中并将其属性设置为始终复制,因为它们是 EMGU 的两个关键文件。

  2. 如果步骤 1 不起作用,请用新副本替换 bin 文件夹中当前的密钥文件。

如果两种方法都失败,则构建可能存在问题,因此请从 Sourceforge 下载 EMGU 的新副本,然后重试。该错误稍后将合并到一篇技术文章中,以便更清楚地解释如何解决该错误。

干杯,
克里斯

The cause of this error (should anyone else run into the same problem) is that the program cannot access opencv_imgproc231.dll or opencv_core231.dll even though they are present in the output "bin" directory.

There are two solutions:

  1. Add them to the project and set their properties to copy always as they are EMGU's two key files.

  2. If step 1 doesn't work, replace the current key files in the bin folder with new copies.

If both methods fail then there may be a problem with the build, so download a new copy of EMGU from Sourceforge and try again. The error will later be incorporated within an technical article in order to provide a clearer explanation of how to solve it.

Cheers,
Chris

扛起拖把扫天下 2024-12-19 10:08:43

无需将它们添加到项目中; VS不会让你的。只需打开FaceRecognizer.cs
public staticpartial class CvInvoke 并将:更改

[DllImport(CvInvoke.EXTERN_LIBRARY, CallingConvention = CvInvoke.CvCallingConvention)] 

为:

[DllImport(Emgu.CV.CvInvoke.EXTERN_LIBRARY, CallingConvention = Emgu.CV.CvInvoke.CvCallingConvention)] 

确保更改所有这些。

No need to add them to the project; VS will not let you. Simply open FaceRecognizer.cs
at public static partial class CvInvoke and change:

[DllImport(CvInvoke.EXTERN_LIBRARY, CallingConvention = CvInvoke.CvCallingConvention)] 

to:

[DllImport(Emgu.CV.CvInvoke.EXTERN_LIBRARY, CallingConvention = Emgu.CV.CvInvoke.CvCallingConvention)] 

Ensure you change all of them.

何处潇湘 2024-12-19 10:08:43

首先以这种方式进行测试:从 emgu cv installaiton 目录中打开一个示例项目并运行它。例如,打开 hello world 示例并尝试运行它。如果示例项目运行没有问题,则安装正确。

对于 emgu cv 示例项目,项目构建设置中的输出路径选项的值设置为'..\.. \
宾'
。要解决您的项目问题,请在 Visual Studio 中打开项目并将输出路径选项的值设置为'C:\Emgu\emgucv 2.9\bin'。尝试运行该项目。它必须成功运行。

现在,将输出路径选项的值设置回bin\Debug\。然后,使用 ADD -> 将 'C:\Emgu\emgucv 2.9\bin' 文件夹中的所有 DLL 文件添加到您的项目中。现有项目菜单。同样,使用 ADD -> 将 'C:\Emgu\emgucv 2.9\bin\x64' 文件夹中的所有 DLL 文件添加到您的项目中。现有项目菜单。现在,转到属性窗口并将所有 dll 文件的复制到输出目录选项设置为始终复制。最后,在“配置管理器”窗口中,为 x64 平台创建新配置。

祝你好运

First test this way: open a sample project from emgu cv installaiton directory and run it. for example, open hello world example and try to run it. if sample projects run with out problem then the installation is correct.

For emgu cv sample projects, value of Output Path option in Build settings of the project is set to '..\..\
bin'
. To fix your project problem, open the project in visual studio and set value of Output Path option to 'C:\Emgu\emgucv 2.9\bin'. Try to run the project. It must run with success.

Now, set back the value of Output Path option to bin\Debug\. Then, add all DLL files in the 'C:\Emgu\emgucv 2.9\bin' folder to your project using ADD -> Existing Item menu. similarly, add all DLL files in the 'C:\Emgu\emgucv 2.9\bin\x64' folder to your project using ADD -> Existing Item menu. Now, go to properties window and set Copy to Output Directory option of all dll files to Copy Always. Finally, in the Configuration Manager window, create a new configuration for x64 platform.

Good Luck

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文