public void CopyFrameDataToArray(ushort[] frameData)
        {
            if (_pNative == RootSystem.IntPtr.Zero)
            {
                throw new RootSystem.ObjectDisposedException("InfraredFrame");
            }

            var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _frameData             = frameDataSmartGCHandle.AddrOfPinnedObject();

            Windows_Kinect_InfraredFrame_CopyFrameDataToArray(_pNative, _frameData, frameData.Length);
            Helper.ExceptionHelper.CheckLastError();
        }
Пример #2
0
        public void CopyConvertedFrameDataToArray(byte[] frameData, Windows.Kinect.ColorImageFormat colorFormat)
        {
            if (_pNative == RootSystem.IntPtr.Zero)
            {
                throw new RootSystem.ObjectDisposedException("ColorFrame");
            }

            var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _frameData             = frameDataSmartGCHandle.AddrOfPinnedObject();

            Windows_Kinect_ColorFrame_CopyConvertedFrameDataToArray(_pNative, _frameData, frameData.Length, colorFormat);
            Helper.ExceptionHelper.CheckLastError();
        }
Пример #3
0
        public void MapColorFrameToCameraSpace(ushort[] depthFrameData, Windows.Kinect.CameraSpacePoint[] cameraSpacePoints)
        {
            if (_pNative == RootSystem.IntPtr.Zero)
            {
                throw new RootSystem.ObjectDisposedException("CoordinateMapper");
            }

            var depthFrameDataSmartGCHandle    = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(depthFrameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _depthFrameData                = depthFrameDataSmartGCHandle.AddrOfPinnedObject();
            var cameraSpacePointsSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(cameraSpacePoints, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _cameraSpacePoints             = cameraSpacePointsSmartGCHandle.AddrOfPinnedObject();

            Windows_Kinect_CoordinateMapper_MapColorFrameToCameraSpace(_pNative, _depthFrameData, depthFrameData.Length, _cameraSpacePoints, cameraSpacePoints.Length);
            Helper.ExceptionHelper.CheckLastError();
        }
Пример #4
0
        public void MapDepthPointsToColorSpace(Windows.Kinect.DepthSpacePoint[] depthPoints, ushort[] depths, Windows.Kinect.ColorSpacePoint[] colorPoints)
        {
            if (_pNative == RootSystem.IntPtr.Zero)
            {
                throw new RootSystem.ObjectDisposedException("CoordinateMapper");
            }

            var depthPointsSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(depthPoints, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _depthPoints             = depthPointsSmartGCHandle.AddrOfPinnedObject();
            var depthsSmartGCHandle      = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(depths, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _depths = depthsSmartGCHandle.AddrOfPinnedObject();
            var colorPointsSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(colorPoints, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _colorPoints             = colorPointsSmartGCHandle.AddrOfPinnedObject();

            Windows_Kinect_CoordinateMapper_MapDepthPointsToColorSpace(_pNative, _depthPoints, depthPoints.Length, _depths, depths.Length, _colorPoints, colorPoints.Length);
            Helper.ExceptionHelper.CheckLastError();
        }
Пример #5
0
        public Windows.Kinect.PointF[] GetDepthFrameToCameraSpaceTable()
        {
            if (_pNative == RootSystem.IntPtr.Zero)
            {
                throw new RootSystem.ObjectDisposedException("CoordinateMapper");
            }

            if (_DepthFrameToCameraSpaceTable == null)
            {
                var desc = KinectSensor.GetDefault().DepthFrameSource.FrameDescription;
                _DepthFrameToCameraSpaceTable = new PointF[desc.Width * desc.Height];

                var pointsSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(_DepthFrameToCameraSpaceTable, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
                var _points             = pointsSmartGCHandle.AddrOfPinnedObject();
                Windows_Kinect_CoordinateMapper_GetDepthFrameToCameraSpaceTable(_pNative, _points, (uint)_DepthFrameToCameraSpaceTable.Length);
                Helper.ExceptionHelper.CheckLastError();
            }

            return(_DepthFrameToCameraSpaceTable);
        }
        public void AddGestures(Microsoft.Kinect.VisualGestureBuilder.Gesture[] gestures)
        {
            if (_pNative == RootSystem.IntPtr.Zero)
            {
                throw new RootSystem.ObjectDisposedException("VisualGestureBuilderFrameSource");
            }

            int _gestures_idx   = 0;
            var _gestures_array = new RootSystem.IntPtr[gestures.Count()];

            foreach (var value in gestures)
            {
                _gestures_array[_gestures_idx] = Helper.NativeWrapper.GetNativePtr(value);
                _gestures_idx++;
            }
            var gesturesSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(_gestures_array, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _gestures             = gesturesSmartGCHandle.AddrOfPinnedObject();

            Microsoft_Kinect_VisualGestureBuilder_VisualGestureBuilderFrameSource_AddGestures(_pNative, _gestures, gestures.Length);
            Helper.ExceptionHelper.CheckLastError();
        }
        public Windows.Kinect.PointF[] GetDepthFrameToCameraSpaceTable()
        {
            if (_pNative == RootSystem.IntPtr.Zero) {
                throw new RootSystem.ObjectDisposedException ("CoordinateMapper");
            }

            if (_DepthFrameToCameraSpaceTable == null) {
                var desc = KinectSensor.GetDefault ().DepthFrameSource.FrameDescription;
                _DepthFrameToCameraSpaceTable = new PointF[desc.Width * desc.Height];

                var pointsSmartGCHandle = new Helper.SmartGCHandle (RootSystem.Runtime.InteropServices.GCHandle.Alloc (_DepthFrameToCameraSpaceTable, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
                var _points = pointsSmartGCHandle.AddrOfPinnedObject ();
                Windows_Kinect_CoordinateMapper_GetDepthFrameToCameraSpaceTable (_pNative, _points, (uint)_DepthFrameToCameraSpaceTable.Length);
                Helper.ExceptionHelper.CheckLastError ();
            }

            return _DepthFrameToCameraSpaceTable;
        }
Пример #8
0
        public void MapColorFrameToCameraSpace(ushort[] depthFrameData, Windows.Kinect.CameraSpacePoint[] cameraSpacePoints)
        {
            if (_pNative == RootSystem.IntPtr.Zero)
            {
                throw new RootSystem.ObjectDisposedException("CoordinateMapper");
            }

            var depthFrameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(depthFrameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _depthFrameData = depthFrameDataSmartGCHandle.AddrOfPinnedObject();
            var cameraSpacePointsSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(cameraSpacePoints, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _cameraSpacePoints = cameraSpacePointsSmartGCHandle.AddrOfPinnedObject();
            Windows_Kinect_CoordinateMapper_MapColorFrameToCameraSpace(_pNative, _depthFrameData, depthFrameData.Length, _cameraSpacePoints, cameraSpacePoints.Length);
            Helper.ExceptionHelper.CheckLastError();
        }
Пример #9
0
        public void MapDepthPointsToColorSpace(Windows.Kinect.DepthSpacePoint[] depthPoints, ushort[] depths, Windows.Kinect.ColorSpacePoint[] colorPoints)
        {
            if (_pNative == RootSystem.IntPtr.Zero)
            {
                throw new RootSystem.ObjectDisposedException("CoordinateMapper");
            }

            var depthPointsSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(depthPoints, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _depthPoints = depthPointsSmartGCHandle.AddrOfPinnedObject();
            var depthsSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(depths, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _depths = depthsSmartGCHandle.AddrOfPinnedObject();
            var colorPointsSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(colorPoints, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _colorPoints = colorPointsSmartGCHandle.AddrOfPinnedObject();
            Windows_Kinect_CoordinateMapper_MapDepthPointsToColorSpace(_pNative, _depthPoints, depthPoints.Length, _depths, depths.Length, _colorPoints, colorPoints.Length);
            Helper.ExceptionHelper.CheckLastError();
        }
        public void AddGestures(Microsoft.Kinect.VisualGestureBuilder.Gesture[] gestures)
        {
            if (_pNative == RootSystem.IntPtr.Zero)
            {
                throw new RootSystem.ObjectDisposedException("VisualGestureBuilderFrameSource");
            }

            int _gestures_idx=0;
            var _gestures_array = new RootSystem.IntPtr[gestures.Count()];
            foreach(var value in gestures)
            {
                _gestures_array[_gestures_idx] = Helper.NativeWrapper.GetNativePtr(value);
                _gestures_idx++;
            }
            var gesturesSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(_gestures_array, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _gestures = gesturesSmartGCHandle.AddrOfPinnedObject();
            Microsoft_Kinect_VisualGestureBuilder_VisualGestureBuilderFrameSource_AddGestures(_pNative, _gestures, gestures.Length);
            Helper.ExceptionHelper.CheckLastError();
        }
Пример #11
0
        public void CopyFrameDataToArray(ushort[] frameData)
        {
            if (_pNative == RootSystem.IntPtr.Zero)
            {
                throw new RootSystem.ObjectDisposedException("InfraredFrame");
            }

            var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject();
            Windows_Kinect_InfraredFrame_CopyFrameDataToArray(_pNative, _frameData, frameData.Length);
            Helper.ExceptionHelper.CheckLastError();
        }
Пример #12
0
        public void CopyConvertedFrameDataToArray(byte[] frameData, Windows.Kinect.ColorImageFormat colorFormat)
        {
            if (_pNative == RootSystem.IntPtr.Zero)
            {
                throw new RootSystem.ObjectDisposedException("ColorFrame");
            }

            var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
            var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject();
            Windows_Kinect_ColorFrame_CopyConvertedFrameDataToArray(_pNative, _frameData, frameData.Length, colorFormat);
            Helper.ExceptionHelper.CheckLastError();
        }