Kinect 2的流在获取3帧后会卡住

本文关键字:3帧 获取 Kinect | 更新日期: 2023-09-27 18:07:00

我使用的是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);
            }
        }

Kinect 2的流在获取3帧后会卡住

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