【问题标题】:Convert from Bitmap to MIplImage or IplImage c#从位图转换为 MIplImage 或 IplImage c#
【发布时间】:2012-07-20 10:41:09
【问题描述】:

我在 c++ 中创建了一个算法来进行背景减法,我想从 c# 调用它,并使用 dll(extern) 使用参数“IplImage”。我在 c# 中获取相机流并将帧作为图像(位图)的问题。

如何将位图转换为 IplImage 以在 c++ 中发送,反之亦然以检索处理过的帧?

非常感谢。

【问题讨论】:

标签: opencv bitmap emgucv iplimage


【解决方案1】:

使用Emgucv,可以试试

Bitmap bitmap = ....
Emgu.CV.Image<Bgr, Byte> img = new Image<Bgr, byte>(bitmap);
Emgu.CV.Structure.MIplImage = img.MIplImage;

要以 C++ 方法发送,您可以将其作为 IntPtr 对象传递

IntPtr r = IntPtr.Zero;
System.Runtime.InteropServices.Marshal.StructureToPtr(img, r, false);

// call your c++ method 
...

另请参阅Marshal 的详细信息

【讨论】:

    猜你喜欢
    • 2014-10-14
    • 1970-01-01
    • 2010-09-28
    • 2013-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-16
    相关资源
    最近更新 更多