我正在使用Kinect传感器通过将视频输入设置为位图源来显示图像上的视频输入,如下所示.但我的问题是如何将图像添加到图像/位图,例如分数计数器,我在下面添加了一张图片来展示我想要实现的目标.
void myKinect_ColorFrameReady(object sender, ColorImageFrameReadyEventArgs e)
{
using (ColorImageFrame colorFrame = e.OpenColorImageFrame())
{
if (colorFrame == null) return;
byte[] colorData = new byte[colorFrame.PixelDataLength];
colorFrame.CopyPixelDataTo(colorData);
KinectVideo.Source = BitmapSource.Create(colorFrame.Width, colorFrame.Height, 96, 96,
PixelFormats.Bgr32, null, colorData, colorFrame.Width * colorFrame.BytesPerPixel);
}
}
Run Code Online (Sandbox Code Playgroud)

我有位图图像变量,我想将它绑定到我的 xaml 窗口。
System.Reflection.Assembly thisExe;
thisExe = System.Reflection.Assembly.GetExecutingAssembly();
string[] resources = thisExe.GetManifestResourceNames();
var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SplashDemo.Resources.Untitled-100000.png");
Bitmap image = new Bitmap(stream);
Run Code Online (Sandbox Code Playgroud)
这是我的 xaml 代码
<Image Source="{Binding Source}" HorizontalAlignment="Left" Height="210" Margin="35,10,0,0" VerticalAlignment="Top" Width="335">
</Image>
Run Code Online (Sandbox Code Playgroud)
你能帮我通过 C# 代码将此位图变量绑定到这个 xaml 图像吗?