473,395 Members | 2,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to convert system.drawing.bitmap to emgu.cv.image in C#?

JOHNYKUTTY
i have to convert an image variable(system.drawing.bitmap orsystem.drawing.image or AForge.Imaging.Image) to Emgu.CV.Image type i have used the code below
Expand|Select|Wrap|Line Numbers
  1. Image<Bgr, Byte> cvimage = new Image<Bgr, Byte>(bmp);
but it is not working but also crashing the program
When i put this code in a try block then it is not crashing.
anyone can help me?????????????
Feb 2 '11 #1
6 20469
GaryTexmo
1,501 Expert 1GB
I'm afraid I don't know what an Emgu.CV.Image is, so I'm afraid I can't help you convert it.

That said, the crash is likely the result of an exception. When you put a try/catch block around it, it's handling the exception and thus not crashing, but you're still not getting the desired result.

Try handling the exception and output the message. This should hopefully give you an idea as to what's wrong.

Expand|Select|Wrap|Line Numbers
  1. try
  2. {
  3.   Image<Bgr, Byte> cvimage = new Image<Bgr, Byte>(bmp);
  4. }
  5. catch (Exception e)
  6. {
  7.   Console.WriteLine(e.Message);
  8.   // or MessageBox.Show(e.Message) if you like
  9. }
Feb 2 '11 #2
the exception message is like this
The type initializer for 'Emgu.CV.cvInvoke' threw an exception
can you explain the reason now
Feb 2 '11 #3
GaryTexmo
1,501 Expert 1GB
No, I can't. I don't know what Emgu.CV.Image is. It looks like it's throwing an internal exception but that's all I can tell you. Is there anything in the inner exception message?

What is Emgu.CV? Is this a library you downloaded? I don't think it's part of the standard .Net framework, so I'm afraid I can't really help you. Perhaps someone else is more familiar with this and can offer some ideas.
Feb 2 '11 #4
Emgu CV is a C# wrapper of open cv(open source computer vision library) which is developed by intel corporation and is consists of some routines for computer vision programming.

You can lean more about open cv here
Feb 3 '11 #5
GaryTexmo
1,501 Expert 1GB
Then unless one of the resident experts here is familiar with this library, I think you're going to have to consult the doc and/or support forums (if any exist) for that library.

Honestly, if I had to take a guess, it would be that you can't supply a bitmap like that... but that's pure speculation. I don't have a background in this, and I'd imagine not many folks around here will... but you never know ;)
Feb 3 '11 #6
Stefs
1
Hi,
I had the same problem. After digging into the exception, I discovered that the compilation could not find "opencv_core231.dll". I copied this dll from the emguCV bin folder into my project folder, and it solved the issue.
Oct 16 '11 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Toby Mathews | last post by:
Hi, In an ASP.Net application I want to convert open create a FileStream object from a System.Drawing.Image - is this possible? I create an instance of an Image object using the FromFile method,...
3
by: david | last post by:
As Title. Thanks in advance. David
1
by: Dennis Myrén | last post by:
Hi. I use System.Drawing.Bitmap to copy bitmap pixel data. I use LockBits to retrieve a BitmapData which in turn provides me with the Scan0 property which i then use to loop the pixel data using...
3
by: instruo | last post by:
I'm using the System.Drawing.Bitmap class for loading a 32-bit bmp file which includes an alpha channel. The problem is, when it gets loaded (just using the Bitmap(string filename) constructor),...
0
by: John via .NET 247 | last post by:
Hi, I'm using the System.Drawing.Bitmap namespace to load an image,and the RotateNoneFlipY method to flip that image before saving.However I have noticed that the saved image appears cropped...
7
by: Fir5tSight | last post by:
Hi All, I used the following code in C#: using System.Drawing; //blah blah blah Bitmap bmp = new Bitmap();
3
by: gudguy | last post by:
dear gurus, I have a 3rd party component that triggers an event and exposed the Width and Height of the video frame, plus the Device context handle (hDC) for the data packet (it is supposed to be...
3
by: wingsganesh | last post by:
Hi buddys, I have the followinf Bug......... when i run my application "NotSupportedException was un handled" in "System.Drawing.Icon" for the following designer code.... ...
3
by: =?Utf-8?B?UGVy?= | last post by:
I'm working on a project that have to load an display pcx-images in a PictureBox-control. When I try to load the file with Bitmap.FromFile I get an exception. Does anybody have an idea ?
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.