多个Kinect流闪烁 [英] Multiple Kinect Stream Flickering

查看:80
本文介绍了多个Kinect流闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在试图找出一种方法来使用2个Kinect进行一些动作捕捉,但我甚至无法得到一些基本的"动作"。视频"从他们那里喂食。使用下面的代码,我可以访问每个Kinect的颜色流,但是当我尝试将sensor1的颜色流发送到
image1和sensor2的颜色流到image2时,两个图像同时(至少在我的眼睛)闪烁在sensor1和sensor2的颜色流。

I'm trying to figure out a way to use 2 Kinects for some motion capture, but I can't even get some a basic "video" feed from them. With the following code, I can access each Kinect's color stream, but when I try to send sensor1's color stream to image1 and sensor2's color stream to image2, the two images simultaneously (at least to my eyes) flicker between sensor1 and sensor2's color stream.

private void Window_Loaded(object sender, RoutedEventArgs e) { sensor1 = KinectSensor.KinectSensors.ElementAt<KinectSensor>(0); sensor2 = KinectSensor.KinectSensors.ElementAt<KinectSensor>(1); if (sensor1 != null) { //sensor1 sensor1.ColorStream.Enable(); //sensor1.DepthStream.Enable(); //sensor1.SkeletonStream.Enable(); sensor1.AllFramesReady += Sensor1_AllFramesReady; sensor1.Start(); } if (sensor2 != null) { //sensor2 sensor2.ColorStream.Enable(); //sensor2.DepthStream.Enable(); //sensor2.SkeletonStream.Enable(); sensor2.AllFramesReady += Sensor2_AllFramesReady; sensor2.Start(); } } void Sensor1_AllFramesReady(object sender, AllFramesReadyEventArgs e) { // Color using (var frame = e.OpenColorImageFrame()) { if (frame != null) { if (mode1 == camera1Mode.Color) { camera1.Source = frame.ToBitmap(); } } } }

void Sensor2_AllFramesReady(object sender,AllFramesReadyEventArgs e)
{
//颜色
使用(var frame = e.OpenColorImageFrame())
{
if(frame != null)
{
if(mode2 == camera2Mode.Color)
{
camera2.Source = frame.ToBitmap();
}
}
}
}


(与Sensor2_AllFramesReady方法相同)



(same thing for Sensor2_AllFramesReady method)


这是因为我需要通过多个USB控制器分开更多带宽(我已经将传感器连接到我的笔记本电脑,没有花哨的双USB卡,或者我的代码是逻辑错误?

Is this because I need separate more bandwidth through multiple USB controllers (I've connected the sensors to my laptop, no fancy dual USB  card present), or is it a logic error in my code?

非常感谢。

这里是XAML代码

<Window x:Class="KinectCoordinateMapping.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Kinect Coordinate Mapping" Height="600" Width="1600"
        Loaded="Window_Loaded" Unloaded="Window_Unloaded">
    <Grid>
        <Image Name="camera1" Width="640" Height="480" Margin="10,44,942,45" />
        <Canvas Name="canvas1" Width="640" Height="480" Margin="10,44,942,45" />
        <Image Name="camera2" Width="640" Height="480" Margin="942,44,10,45" />
        <Canvas Name="canvas2" Width="640" Height="480" Margin="942,44,10,45" />
    </Grid>
</Window>




推荐答案

您需要多个USB主机控制器才能支持多个传感器。如果你的笔记本电脑共享相同的USB2卡,那么这将无法正常工作。您是否能够使一个传感器正常工作?
You need multiple USB Host controllers to support multiple sensors. If you laptop shares the same USB2 card, then this will not work. Are you able to get one sensor working without issues?


这篇关于多个Kinect流闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆