我想问一下是否有任何方法可以检查当前是否正在使用Kinect(sensor.start),以便我们可以将另一个Kinect用于另一个应用程序或同一应用程序?我尝试使用Kinect.IsRunning,但无法正常工作。
就是这种情况:我有一个可以在一个Kinect上运行的应用程序,但是我想两次运行此应用程序。我有两个Kinects连接到我的PC。问题是,每当我运行第二个应用程序时,它将检测到要使用的相同Kinect,从而导致第二个应用程序崩溃。我希望此应用程序可以知道第一个Kinect传感器是否已经启动,它将用于下一个。我已经阅读了这篇文章,但是并不能帮助我解决这个问题。http://social.msdn.microsoft.com/Forums/zh-CN/e8e96d97-ec02-430e-b80c-a40ae6b92604/running-two-instances-of-the-same-app-for-two-kinects?forum= Kinectsdknuiapi
到目前为止,我已将Kinect ID硬编码到我的应用程序中,但这意味着我需要拥有两个效率不高的应用程序。如果需要更改Kinect,则需要再次在代码内更改ID。任何人都可以帮助我。请?我以为应该不难,但是我仍然没有找到任何功能可以做到这一点。我正在VB.Net中编写我的代码
我会做这样的事情:
For Each _sensor As KinectSensor In KinectSensor.KinectSensors
sensor = _sensor
...//setup event handlers and such
Try
sensor.Start() //If it gets past this, then we can exit as it has
// successfully started a kinect
Exit For
Catch ex As ApplicationException
MsgBox("That Kinect is being used in another application, moving to the next")
Catch ex2 As IOException
MsgBox("Error")
End Try
Next
这将搜索所有kinect,尝试启动它们,如果ApplicationException
抛出an ,则它将移至下一个kinect。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句