runtime error on call of CvInvoke::cvCreateImage method

Ask questions on using Emgu CV with C++
Post Reply
iman_kh
Posts: 11
Joined: Tue Sep 09, 2008 1:46 am

runtime error on call of CvInvoke::cvCreateImage method

Post by iman_kh » Tue Sep 09, 2008 1:59 am

hi,
i called CvInvoke.cvLoadImage as the below :

IntPtr ptr=CvInvoke::cvCreateImage(MCvSize(100, 50), Emgu::CV::CvEnum::IPL_DEPTH::IPL_DEPTH_8U, 1);

but on runtime i have encountered with this error :

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

how can i solve this error ?
thanks

canming
Site Admin
Posts: 1036
Joined: Thu Feb 28, 2008 4:16 pm

Re: runtime error on call of CvInvoke::cvCreateImage method

Post by canming » Tue Sep 09, 2008 8:40 am

The first thing you can do is to make sure the opencv dlls ("cv100.dll, cxcore100.dll, cvaux100.dll, highgui100.dll") are in the same directory of your executable. They have to be exact same name. (e.g. cv100.dll not cv100d.dll)

If everything in the right place, it seems that the the static constuctor of CvInvoke class creates an error. The static constructor only has one line of code that try to register the Exception handler for Emgu CV. It works fine with the OpenCV 1.0.0.0 dll, are you using the same dll or are you building from the opencv CVS code?

Regards,
Canming

MDS
Posts: 38
Joined: Sun Jul 12, 2009 8:31 am

Re: runtime error on call of CvInvoke::cvCreateImage method

Post by MDS » Sun Jul 12, 2009 2:46 pm

canming wrote:The first thing you can do is to make sure the opencv dlls ("cv100.dll, cxcore100.dll, cvaux100.dll, highgui100.dll") are in the same directory of your executable. They have to be exact same name. (e.g. cv100.dll not cv100d.dll)

If everything in the right place, it seems that the the static constuctor of CvInvoke class creates an error. The static constructor only has one line of code that try to register the Exception handler for Emgu CV. It works fine with the OpenCV 1.0.0.0 dll, are you using the same dll or are you building from the opencv CVS code?

Regards,
Canming
Thanks , My problem has solved

n0ran
Posts: 3
Joined: Fri Jun 11, 2010 4:16 am

Re: runtime error on call of CvInvoke::cvCreateImage method

Post by n0ran » Fri Jun 11, 2010 6:43 am

canming wrote:The first thing you can do is to make sure the opencv dlls ("cv100.dll, cxcore100.dll, cvaux100.dll, highgui100.dll") are in the same directory of your executable.
Hello, I added the files but still i get this error
An unhandled exception of type 'System.TypeInitializationException' occurred in Emgu.CV.dll
Additional information: The type initializer for 'Emgu.CV.CvInvoke' threw an exception.
Note: I'm working on a 64-bits OS
i downloaded a newer version, so the dlls names are a bit different {cv210.dll, ....}
i tried to build the solution for 64bits & also for x86 (32 bits)
both build successfully & result in the same run-time exception :S

the exception happens here:

Code: Select all

    Matrix<float> srcImageMatrix = new Matrix<float>(sourcImage);
Any ideas?!
Thaanks in advance,
any help is really appreciated :)

n0ran
Posts: 3
Joined: Fri Jun 11, 2010 4:16 am

Re: runtime error on call of CvInvoke::cvCreateImage method

Post by n0ran » Sat Jun 12, 2010 2:02 am

Thaanks a lot
problem solved.

I used OpenCV v.1.1, copied the files & built as x86

JDG
Posts: 1
Joined: Thu Oct 28, 2010 7:38 am

Re: runtime error on call of CvInvoke::cvCreateImage method

Post by JDG » Thu Oct 28, 2010 7:46 am

I had this problem but fixed it by copying these 4 files to the same directory as the executable (MyProject\bin\Debug\):
cv210.dll
cvaux210.dll
cxcore210.dll
highgui210.dll

Some posts said that you have to use xx100.dll's but I do not find this to be the case, at least not on the system I am using.

Here are the specs I have:
IDE: Visual Studio 2010
Build Settings Platform Target: x86
Development Technology: WPF with .NET 4.0.
OS: WIndows 7
Processor: 64 bit

giusdisa
Posts: 33
Joined: Tue Oct 19, 2010 3:22 pm
Contact:

Re: runtime error on call of CvInvoke::cvCreateImage method

Post by giusdisa » Thu Oct 28, 2010 8:30 am

JDG wrote:I had this problem but fixed it by copying these 4 files to the same directory as the executable (MyProject\bin\Debug\):
cv210.dll
cvaux210.dll
cxcore210.dll
highgui210.dll

Some posts said that you have to use xx100.dll's but I do not find this to be the case, at least not on the system I am using.

Here are the specs I have:
IDE: Visual Studio 2010
Build Settings Platform Target: x86
Development Technology: WPF with .NET 4.0.
OS: WIndows 7
Processor: 64 bit
Of course xx100.dll files were in place two years ago when the thread was started. :)

flyrcdream
Posts: 3
Joined: Tue Jul 03, 2012 11:14 pm

Re: runtime error on call of CvInvoke::cvCreateImage method

Post by flyrcdream » Wed Jul 04, 2012 1:06 am

Note: I'm working on a 64-bits OS
i downloaded a newer version, so the dlls names are a bit different {cv210.dll, ....}
i tried to build the solution for 64bits & also for x86 (32 bits)

jhonjame
Posts: 2
Joined: Thu Jun 20, 2013 6:18 am

Re: runtime error on call of CvInvoke::cvCreateImage method

Post by jhonjame » Thu Jun 20, 2013 6:48 am

I realy like it .I appericate this thread.Awesome! Thanks for that!

nahiiii
Posts: 1
Joined: Thu Apr 02, 2015 5:34 am

Re: runtime error on call of CvInvoke::cvCreateImage method

Post by nahiiii » Thu Apr 02, 2015 5:51 am

Thaanks a lot problem solved.

Post Reply