【发布时间】:2014-03-20 09:42:08
【问题描述】:
我正在使用 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);
}
}
【问题讨论】:
-
为什么要添加到位图图像本身?在其上添加一个具有透明背景的图层。