Saturday, July 6, 2013

EmguCV and Getting the Right Libraries in the Right Places!

Some quick hints for now, and hopefully I'll fill this in more later : )

If you see the exception "The type initializer for 'Emgu.CV.CvInvoke' threw an exception." then you need to dig deeper to figure out what actually happened.  View details of the exception and drill down into the InnerException until you get to the bottom.  You'll probably find one of these...

Exception: Probable Cause
"An attempt was made to load a program with an incorrect format." : You are compiling for 32-bit but the OpenCV library you are using was compiled for 64-bit.  Or the other way around.

"Unable to load DLL 'opencv_core240': The specified module could not be found" : The core240 DLL is not in the same folder as your executable...or if you do have it there then you might need to install (or reinstall) The Microsoft Visual C++ 2010 redistributable package of the latest Service Pack (SP1 is current as of this writing).  x86: http://www.microsoft.com/en-us/download/details.aspx?id=8328  x64: http://www.microsoft.com/en-us/download/details.aspx?id=13523

Still having trouble loading the core240?  Use the great Dependency Walker tool from http://www.dependencywalker.com/ to open the core240 DLL and see what other DLLs might be missing!

1 comment: