How to create Emgu Image from System.Drawing.Image?

前端 未结 3 1600
没有蜡笔的小新
没有蜡笔的小新 2021-01-15 05:32

I have a source that gives me a jpeg in memory stream (Bytes).
I can convert it to System.Drawing.Image but I don\'t know how
to convert it to Emgu Image.

M

3条回答
  •  耶瑟儿~
    2021-01-15 06:08

    Using ps2010 solution, I had wrote this to get image from a http:

    try
    {                
        using (WebClient client = new WebClient())
        {                    
            data = client.DownloadData("http://LINK TO PICTURE");
        }       
    }
    catch (Exception ex)
    {
        // error treatment
    }
    
    MemoryStream ms = new MemoryStream(data);
    Bitmap bmpImage = new Bitmap(Image.FromStream(ms));
    Emgu.CV.Image currentFrame = new Emgu.CV.Image(bmpImage);
    gray = currentFrame.Convert();
    

提交回复
热议问题