问题描述
Hey All,
我正在处理我的业余爱好项目,并希望了解如何将KinectSensor传递给多个线程。
Am working on a hobby project of mine and wanted to find out how to pass KinectSensor to multiple threads.
示例尝试下面的内容
Example trying something like below
class Program
{
static AutoResetEvent autoEvent;
static void Main(string[] args)
{
autoEvent = new AutoResetEvent(false);
// Initialize Kinect Sensor and handle all kinds of connect/disconnect scenarios.
Initialize init = new Initialize();
KinectSensor sensor = init.InitializeKinectSensor();
SpeechControl sc = new SpeechControl();
Console.WriteLine("main thread starting worker thread...");
//Now here want to pass sensor to speech control
Thread sct = new Thread(sc.SpeechControlMain(sensor));
sct.Start();
// Now want to pass same sensor to another thread doing gesture recognition
GestrureControl gc = new GestureControl(); Thread gct = new Thread(gc.GestureControlMain(sensor));
gct.start();
}
}
如果我们希望不同的线程处理来自kinect的流数据的不同方面,这将是正确的方法传感器?如果有人能指出我正确的方向/示例代码,将不胜感激。
would this be the right approach if we wanted different threads to be processing different aspects of the stream data from the kinect sensor ? Would be grateful if anyone could point me in the right direction/sample code.
推荐答案
查看Kinect Explorer示例,了解如何完成此任务。
Have a look at the Kinect Explorer sample to give you some ideas on how you can accomplish this task.
这篇关于将KinectSensor和/或流传递给线程..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!