【发布时间】:2012-02-13 07:02:28
【问题描述】:
我编写了一个外部 C# dll,它接收图像并进行图像处理以检测手部姿势。 我目前正在使用 ZigFu 统一绑定来获取 kinect 数据。现在我想将图像/深度数据从 Kinect 传递到我的 C# dll。
以下是代码摘录:
Unity 中的 C#
h1.detectHandPose(OpenNIContext.Instance.Depth.GetDepthMap().XRes,OpenNIContext.Instance.Depth.GetDepthMap().YRes);
其中 h1 是我的 C# dll 类的实例
和 C# dll 中的代码
public int detectHandPose(IntPtr srcptr,Int32 w,Int32 h)
{
int fingerNum = 0;
Bitmap srcbmp = new Bitmap(w, h, 2,System.Drawing.Imaging.PixelFormat.Format16bppGrayScale, srcptr);
ccDefects(srcbmp);
return fingerNum;
}
public Image<Bgr, Byte> ccDefects(Bitmap b)
{
//all image processing code for convexity defects
}
但是我无法运行它并出现以下错误:
ArgumentException:找到空引用或无效值 [GDI+ 状态:InvalidParameter] System.Drawing.GDIPlus.CheckStatus(Status 状态)System.Drawing.Bitmap..ctor(Int32宽度,Int32高度,Int32 stride, PixelFormat 格式, IntPtr scan0) (wrapper remoting-invoke-with-check) System.Drawing.Bitmap:.ctor (int,int,int,System.Drawing.Imaging.PixelFormat,intptr) handDetectionDLL.handDetection.detectHandPose (IntPtr srcptr, Int32 w, Int32 h) OpenNIDepthmapViewer.FixedUpdate () (在 Assets/OpenNI/Scripts/OpenNIDepthmapViewer.cs:152)
感谢任何帮助。
谢谢, 库马尔
【问题讨论】:
-
你试过answers.unity3d.com 吗?这可能需要几个小时,但您可能会在那里得到更好的答案。