opencv_imgproc.dll抛出BadImageFormatException [英] opencv_imgproc.dll throws BadImageFormatException

查看:209
本文介绍了opencv_imgproc.dll抛出BadImageFormatException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Emgu CV(用于x64)构建图像处理应用程序,并且想对图像使用过滤功能。因此,我使用 opencv_imgproc.dll ,但它会抛出 BadImageFormatException

I'm building an image processing application using Emgu CV (for x64) and I want to use the filtering functions on images. So, I use opencv_imgproc.dll but it throws BadImageFormatException

Solution Platform : x86 
Operating System : Windows 7 - 64
Language: C# 
IDE: Visual C# 2010 express 


推荐答案

Emgu 是OpenCV的托管包装。由于OpenCV是不受管理的,因此您需要确保使用正确的设置来编译所使用的Emgu版本。

Emgu is a managed wrapper for OpenCV. Because OpenCV is unmanaged, you will need to ensure that you are compiling with the correct settings for the version of Emgu you are using.

基于注释中发布的异常( http://pastie.org/5170481 http://pastie.org/5170499 供参考),针对的Emgu版本是x86,这意味着它依赖的OpenCV DLL需要编译为32位。为了运行代码,无论您使用哪种项目,都必须将项目的构建设置中的平台目标设置为 x86

Based on the exceptions posted in the comments (http://pastie.org/5170481 and http://pastie.org/5170499 for reference), the Emgu version being compiled against is the x86 one, meaning that the OpenCV DLLs it depends on will need to be compiled for 32-bit . For your code to run, the Platform target in the Build settings of you project needs to be set to x86, regardless of the bitness of the OS you are running on.

要使用Emgu的64位版本,您需要下载针对64位编译的版本(您可以可以在此处
中看到不同的选项,然后设置平台目标 x64

To use the 64-bit version of Emgu, you will need to download a version compiled for 64-bit (you can see the different options here) and then set the Platform target to x64.

这篇关于opencv_imgproc.dll抛出BadImageFormatException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆