OpenCV中文网站

 找回密码
 立即注册
搜索
热搜: 安装 配置
查看: 3692|回复: 0

如何在C#工程下,接收用C+写的dll的 opencv 类型

[复制链接]
发表于 2012-8-31 22:39:55 | 显示全部楼层 |阅读模式
比如我在dll中有这样一段
extern "C" __declspec(dllexport) IplImage* photo(int x, int y)  
{  
         IplImage *videoImgLearn = cvLoadImage("imgs/1.jpg"); ;

    return videoImgLearn;  
}

在C#中调用

[DllImport("CSharpInvokeCPP.CPPDemo.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr photo(int a, int b);

然后在main中调用

  IntPtr image = CPPDLL.photo(1, 1);


运行时image总是0

我即使在C#中用Emgu.CV,但是这个的类型也是IntPtr ,也不行希望高手帮帮忙啊,或者给个参考资料。。纠结好久了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|OpenCV中文网站

GMT+8, 2024-5-6 17:37 , Processed in 0.012487 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表