change
change

Reputation: 3568

read a PNG image using emgu Image

After saving a image in PNG format using

bitmap.save(filename, ImageFormat.PNG),

I now try to read the same image

Image<Rgb, Byte> inpImage = new Image<Rgb, Byte>(dir + fn_only + "_ms.png") using emgu Image. On runtime I get a

System.TypeInitializationException occurred in Emgu.CV.dll

Exception:

System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'opencv _core242': The specified module could not be found. (Exception from HRESULT: 0x8 007007E) at Emgu.CV.CvInvoke.cvRedirectError(CvErrorCallback errorHandler, IntPtr user data, IntPtr prevUserdata) at Emgu.CV.CvInvoke..cctor() --- End of inner exception stack trace --- at Emgu.CV.Image`2..ctor(String fileName)

when opencv_242 is present. On dependency check it says NVCUDA is missing. I do not have a GPU, obv there wont be NVCUDA in that case.

I tried color type RGB and BGR.

Upvotes: 0

Views: 3702

Answers (1)

chefjuanpi
chefjuanpi

Reputation: 1697

//a way is first open the PNG in a bitmap

Bitmap bitmap = new Bitmap(dir + fn_only + "_ms.png");

//and read the bitman how image

Image<Rgb, Byte> inpImage = new Image<Rgb, Byte>(bitmap);

ref: http://www.emgu.com/wiki/index.php/Working_with_Images Creating image from Bitmap

Upvotes: 2

Related Questions