Click here to Skip to main content
15,920,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am working on Emgu cv as a console application and I was trying to load an jpeg format image file from computer disk.I have tried the following ways but nothing is working?

Image input = Image.FromFile("C://Users//...//Image.jpg");
Bitmap master = (Bitmap)input;
Image<Gray,byte> InputImage = new Image<Gray,byte>(master);

And this way too
Image<Bgr,byte> inputImage = new Image<Bgr,byte>("C:\\Users\...\Image.jpeg");
Image<Gray,byte> grayFrame = inputImage.Convert<Gray,byte>();

Both ways Its not working.Any other option? It stops running here

_ptr = CvInvoke.cvCreateImageHeader(new Size(cols, rows), CvDepth, numberOfChannels);

in a class known to be Image.cs of Emgu cv.And it throws type initializer for 'Emgu.CV.CvInvoke' Exception.The File path is perfect/correct.the error looks like this. Could you please tell me what i am doing wrong here? Thanks
Updated 15-Jun-13 14:28pm
Ron Beyer 15-Jun-13 22:56pm    
Click on the "View Detail" link at the bottom of the exception window. Look at the exception description and especially the inner exception. Look at all the arguments being passed into the function to see that they are set correctly.
sizusuzu 16-Jun-13 6:15am    
The inner exception is "System.BadImageFormatException
An attempt was made to load a program with an incorrect format Exception for hresult 0x8007000B."
Configuration manager and build target are the same both any cpu.

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