Click here to Skip to main content
15,880,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I am using OpenCVSharp library to use opencv in C#. I'm trying to load image from a file using this code:
C#
IplImage cap = Cv.LoadImage("D:\\eye1.jpg",LoadMode.AnyDepth);

but it shows exception: "TypeInitializationException was unhandled;The type initializer for 'OpenCvSharp.NativeMethods' threw an exception." I have tried searching on google but can't get any help about it.
Posted
Comments
[no name] 27-Apr-14 9:51am    
The most likely explanation is that Cv is not a static class. The inner exception might have more information.

1 solution

Try to put the files:
opencv_coreXXX.dll
opencv_highguiXXX.dll
opencv_imgprocXXX.dll
opencv_videoXXX.dll
(XXX - version of your OpenCV)
in the directory of your project (Project/bin/debug/).
And check that bit of libraries and your Visual Studio compiler match. (x86 or x64).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900