2012-07-21 177 views
1

我有一个在C++中创建的算法,使背景减法,我想从c#调用它与参数“IplImage”使用dll(extern)。我在c#中获取相机流的问题,我有帧作为图像(位图)。从位图转换为MIplImage或IplImage c#

我怎样才能将位图转换为IplImage发送它在c + +反之亦然检索帧处理?

非常感谢。

+0

显示详细一些代码帮助 – 2012-07-25 09:11:41

+0

检查了这一点http://opencv-users.1802565.n2.nabble.com/sending-Bitmap-class-argument-to-C-function-and-using-it-for-IplImage-td5599929.h TML – Mark 2013-04-28 09:33:25

回答

0

使用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