Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何并行化Kinect AllFramesReady事件_C#_Multithreading_Parallel Processing_Task Parallel Library_Kinect - Fatal编程技术网

C# 如何并行化Kinect AllFramesReady事件

C# 如何并行化Kinect AllFramesReady事件,c#,multithreading,parallel-processing,task-parallel-library,kinect,C#,Multithreading,Parallel Processing,Task Parallel Library,Kinect,我正在使用Kinect进行开发,需要在AllFramesReady事件中执行任务。 这项任务包括使用二进制编写器进行大量编写 我知道帧(颜色、深度、骨架)存在的时间很短 using (var imageFrame = e.OpenColorImageFrame()) { // Do the heavy task writing tons of bits do a `BinaryWriter` } // The frame is no longer available :( 有没有办法

我正在使用Kinect进行开发,需要在AllFramesReady事件中执行任务。 这项任务包括使用
二进制编写器进行大量编写

我知道帧(颜色、深度、骨架)存在的时间很短

using (var imageFrame = e.OpenColorImageFrame())
{
     // Do the heavy task writing tons of bits do a `BinaryWriter`
} // The frame is no longer available :(

有没有办法将其并行化?或者一些技巧来提高代码的性能?

通常,不要在AllFramesReady事件处理程序中执行繁重的操作。我的建议是:将帧信息存储在队列中,然后使用另一个线程将存储的信息写入磁盘内存。请注意,当进入队列的速率超过离开队列的速率时,在某一点上,您将耗尽内存。

在1.6 SDK示例中,KinectWpfViewers项目中的
KinectDepthViewer
在并行过程中进行深度着色。这可能是一个好的开始。当我在我的电脑前可以访问代码时,我也会进行更多的调查。谢谢,我也会进行调查。