1
我已经添加了代码来从Kinect传感器获取视频流,并且它可以在一个带有图像控件的窗口中正常工作。如何将位图源设置为包含在Viewbox中的图像?
但是,当我在新窗口中添加不同xaml布局的相同实现时,Feed不显示,所以我猜测我设置xaml布局的方式存在问题。
有谁知道什么可能导致图像不显示? 是否有一个属性导致这个或者我没有使用的属性?
这是怎么了我构建的布局有问题的类:
<Window x:Class="BVversion1.ConditioningFrm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ConStackPanelditioningFrm" Height="377.612" Width="637.313">
<Viewbox Stretch="Uniform" HorizontalAlignment="Center">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<Button x:Name="pushUpBtn" Content="Push Ups" Width="100" Click="pushUpBtn_Click"/>
<Button x:Name="burpeeBtn" Content="Burpee" Width="100" Click="burpeeBtn_Click"/>
<Button x:Name="squatBtn" Content="Squat" Width="100" Click="squatBtn_Click"/>
<Button x:Name="coreBtn" Content="Core" Width="100" Click="coreBtn_Click"/>
</StackPanel>
<Image x:Name="KinectVideo" Width="640" Height="250" Visibility="Visible"/>
<Button x:Name="homeBtn" Content="Home" Width="75" Click="homeBtn_Click"/>
</StackPanel>
</Viewbox>
</Window>
我的图像KinectVideo
设置为位图的这样的源:在这出
KinectVideo.Source = BitmapSource.Create(colorFrame.Width, colorFrame.Height, 96, 96,
PixelFormats.Bgr32, null, colorData, colorFrame.Width * colorFrame.BytesPerPixel);
如何将ViewBox绑定到kinect相机? – Yoda
我不只是将图像源“KinectVideo”设置为BitMapSource ...如果我使用视图框,我应该以不同的方式做这件事吗? –
你是否同时运行两个窗口? –