使用 Kinect 进行线程化
我正在编写一个使用 Kinect 的 C# 应用程序,我当前正在获取输出并将其写入着色器资源并将其渲染为纹理,我的问题是 Kinect(显然)仅以 30fps 运行,因此它受到限制我的表现很糟糕。
克服这个问题的最佳方法是什么,是多线程吗? 是否有某种设计模式可以帮助解决此类问题? 据我所知,我可能想让 kinect 在线程上处理数据,然后在进程完成后访问它,但我不确定从哪里开始以安全的方式。
感谢您提供的任何建议。
我目前使用 OpenNI 作为 kinect 驱动程序/api,使用 SlimDX 作为 directX 渲染端。
I am writing a C# application that is using the Kinect, i am taking the output currently and writing it to a Shader Resource and rendering it as a texture, my issue is that the Kinect (apparently) only runs at 30fps, so it is throttling my performance badly.
What is the best way to overcome this, is it multithreading?
Is there some sort of design pattern that would help with this type of issue?
As far as i can tell i may want to have the kinect processing the data on a thread, and then get access to it when the process is finished, but i'm not sure where to start with that in a safe manner.
Thanks for any advice you can offer.
I am currently using OpenNI for the kinect drivers/api, and SlimDX for the directX side of rendering.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我以前没有使用过 Kinect,并且您没有指定您正在使用哪些驱动程序/包装器,但我怀疑这可能并不重要。
您可能需要执行以下操作:
对于有关 C# 线程的优秀教程,我始终推荐 Albahari's Threading in C#。我还建议,如果您想要有关如何加快应用程序速度的更多具体信息,您可能应该编辑您的问题并添加有关您现在如何构建它以及您正在使用什么包装器/驱动程序等的详细信息。
I have not worked with the Kinect before and you didn't specify which drivers/wrapper you are using, but I suspect that it probably won't matter.
What you will probably need to do is the following:
For excellent tutorials on threading in c#, I always recommend Albahari's Threading in C#. I would also recommend if you want more specific information on what you can do to speed up your application, you should probably edit your question and add details about specifically how you have it structured now and what wrapper/driver's you are using, etc.
任何需要高性能的 Kinect 开发都应该使用池模型而不是事件模型。作为补充,您最好的选择是打开一个线程并执行池操作。
您也可以将线程与事件模型一起使用,以进行长时间操作而不冻结用户界面。
您可以看到: http://msdn.microsoft.com/en-us/library /hh973076
Any development with Kinect that requires high perfomance you should use the pooling model instead event model. And complementary to this, your best option is open a thread and do the pooling operations.
You can use too threads with event model , to make long time operations and not freeze the user interface.
And you can see this : http://msdn.microsoft.com/en-us/library/hh973076