コード例 #1
0
ファイル: Wrapper.cs プロジェクト: wmyw96/MotionSDKWrapper
        // cast intptr to st_motion_body_t[]
        public static void Recon_Body_T(IntPtr ptr, out st_motion_body_t[] p_bodies, int cnt)
        {
            p_bodies = null;
            var sizeInBytes = Marshal.SizeOf(typeof(st_motion_body_t));

            p_bodies = new st_motion_body_t[cnt];
            for (int i = 0; i < cnt; i++)
            {
                IntPtr p = new IntPtr((ptr.ToInt64() + i * sizeInBytes));
                p_bodies[i] = (st_motion_body_t)Marshal.PtrToStructure(p, typeof(st_motion_body_t));
            }
        }
コード例 #2
0
ファイル: Wrapper.cs プロジェクト: wmyw96/MotionSDKWrapper
        // cast intptr to managed datatype
        public static void Recon_keypoints(st_motion_body_t input, out st_pointf_t[] keypoints, out float[] keypoint_scores)
        {
            //st_motion_body_t input = (st_motion_body_t)Marshal.PtrToStructure(inputptr, typeof(st_pointf_t));
            var sizeInBytes = Marshal.SizeOf(typeof(st_pointf_t));

            keypoints       = new st_pointf_t[input.keypoints_count];
            keypoint_scores = new float[input.keypoints_count];
            for (int i = 0; i < input.keypoints_count; i++)
            {
                IntPtr p = new IntPtr((input.keypoints.ToInt64() + i * sizeInBytes));
                keypoints[i] = (st_pointf_t)Marshal.PtrToStructure(p, typeof(st_pointf_t));
            }
            Marshal.Copy(input.keypoint_scores, keypoint_scores, 0, input.keypoints_count);
        }