画像を取り込んで手の姿勢を検出するための画像処理を行う外部C#dllを作成しました。 私は現在kinectデータを取得するためにZigFuユニティバインディングを使用しています。今私はKinectからC#dllにImage/Depthデータを渡したいと思います。続きUnity C#から外部C#dllに画像/デプスデータを渡す
はコードの抽出物である:ユニティで
C#の
h1.detectHandPose(OpenNIContext.Instance.Depth.GetDepthMap().XRes,OpenNIContext.Instance.Depth.GetDepthMap().YRes);
h1はC#のDLLの私のC#のDLLクラス
を、コードのinstaceある
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: A null reference or invalid value was found [GDI+ status: InvalidParameter] System.Drawing.GDIPlus.CheckStatus (Status status) System.Drawing.Bitmap..ctor (Int32 width, Int32 height, Int32 stride, PixelFormat format, 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() (at Assets/OpenNI/Scripts/OpenNIDepthmapViewer.cs:152)
何か助けていただければ幸いです。
おかげで、
クマー
http://answers.unity3d.comを試しましたか?それには数時間かかることがありますが、そこではより良い回答が得られる可能性があります。 –