opencv_imgproc.dll throws BadImageFormatException

蹲街弑〆低调 提交于 2019-12-13 03:59:49

问题


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 

回答1:


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.

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.

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.



来源:https://stackoverflow.com/questions/13170952/opencv-imgproc-dll-throws-badimageformatexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!