コード例 #1
0
        public Microsoft.Kinect.PointF[] ComputeDepthFrameToCameraSpaceTable()
        {
            float fx = (float)depthCameraMatrix[0, 0];
            float fy = (float)depthCameraMatrix[1, 1];
            float cx = (float)depthCameraMatrix[0, 2];
            float cy = (float)depthCameraMatrix[1, 2];

            float[] kappa = new float[] { (float)depthLensDistortion[0], (float)depthLensDistortion[1] };

            var table = new Microsoft.Kinect.PointF[depthImageWidth * depthImageHeight];

            for (int framey = 0; framey < depthImageHeight; framey++)
            {
                for (int framex = 0; framex < depthImageWidth; framex++)
                {
                    double xout, yout;
                    Undistort(fx, fy, cx, cy, kappa, framex, (depthImageHeight - framey), out xout, out yout);

                    var point = new Microsoft.Kinect.PointF();
                    point.X = (float)xout;
                    point.Y = (float)yout;
                    table[depthImageWidth * framey + framex] = point;
                }
            }
            return(table);
        }
コード例 #2
0
        //DragDropDecoratorのCanvas.Top,Canvas.Leftプロパティを更新
        void inputModel_ManipulationUpdated(object sender, Microsoft.Kinect.Input.KinectManipulationUpdatedEventArgs e)
        {
            //DragDropDecoratorの親はCanvas
            Canvas canvas = _dragDropDecorator.Parent as Canvas;

            if (canvas != null)
            {
                double y = Canvas.GetTop(_dragDropDecorator);
                double x = Canvas.GetLeft(_dragDropDecorator);
                if (double.IsNaN(x) || double.IsNaN(y))
                {
                    return;
                }
                Microsoft.Kinect.PointF delta = e.Delta.Translation;
                //deltaは-1.0..1.0の相対値で表されているので
                //KinectRegionに合わせて拡大
                var Dy = delta.Y * _kinectRegion.ActualHeight;
                var Dx = delta.X * _kinectRegion.ActualWidth;
                Canvas.SetTop(_dragDropDecorator, y + Dy);
                Canvas.SetLeft(_dragDropDecorator, x + Dx);
            }
        }
コード例 #3
0
 // store body lean data, -1 to 1 represents -45 deg to 45deg
 internal void write_body_lean(Microsoft.Kinect.PointF lean, int i)
 {
     body_lean[button_number][0][i] = lean.X;
     body_lean[button_number][1][i] = lean.Y;
 }