我正在使用Kinect v2,并且有一个小程序,只显示主体和颜色流,但是该流仅提取3帧后就停止发送帧。这是代码:

_sensor = KinectSensor.GetDefault();

        if (_sensor != null)
        {
            _sensor.Open();

            _reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.Infrared | FrameSourceTypes.Body);
            _reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived;
        }


这就是我得到帧的方式

Console.WriteLine("==== FRAME FOUND ====");
        var reference = e.FrameReference.AcquireFrame();
        // Body
        using (var frame = reference.ColorFrameReference.AcquireFrame())
        {
            if (frame != null)
            {
                //stream.Children.Clear();
                var c_frame = reference.ColorFrameReference.AcquireFrame();
                ImageBrush ib = new ImageBrush();
                Image im = new Image();
                rgb.Source = frame.ToBitmap();
                var b_frame = reference.BodyFrameReference.AcquireFrame();
                _bodies = new Body[b_frame.BodyFrameSource.BodyCount];
                b_frame.GetAndRefreshBodyData(_bodies);
                if (_bodies[0].IsTracked)
                {
                    stream.DrawSkeleton(_bodies[0]);
                    if (recording)
                    {
                        recorder.RecordFrame(_bodies[0]);
                    }
                }
                b_frame.GetAndRefreshBodyData(_bodies);
            }
        }

最佳答案

您的构建目标很可能设置为32位CPU。将其设置为64位。

10-07 18:31