Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在VS 2013 wpf应用程序中,kinect如何使用可写位图来保存视频信息?_C#_Wpf_Visual Studio 2013_Kinect_Writeablebitmap - Fatal编程技术网

C# 在VS 2013 wpf应用程序中,kinect如何使用可写位图来保存视频信息?

C# 在VS 2013 wpf应用程序中,kinect如何使用可写位图来保存视频信息?,c#,wpf,visual-studio-2013,kinect,writeablebitmap,C#,Wpf,Visual Studio 2013,Kinect,Writeablebitmap,我正在查看Kinect开发者工具包中的颜色基本示例 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using Syste

我正在查看Kinect开发者工具包中的颜色基本示例

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Kinect;
using Microsoft.Kinect.Toolkit;
using Microsoft.Kinect.Toolkit.Controls;


namespace BrianColorViewer
{
    public partial class MainWindow : Window
    {
        KinectSensor sensor;
        WriteableBitmap colorBitmap;
        byte[] colorPixels;

        public MainWindow()
        {
            InitializeComponent();            
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            foreach (var potential in KinectSensor.KinectSensors)
            {
                if (potential.Status == KinectStatus.Connected)
                {
                    sensor = potential;
                    break;
                }
            }

            if (null != sensor)
            {
                sensor.ColorStream.Enable(ColorImageFormat.RgbResolution1280x960Fps12);
                colorPixels = new byte[sensor.ColorStream.FramePixelDataLength];
                colorBitmap = new WriteableBitmap(sensor.ColorStream.FrameWidth,     sensor.ColorStream.FrameHeight, 96.0, 96.0, PixelFormats.Bgr32, null);
                Image.Source = colorBitmap;
                sensor.ColorFrameReady += sensor_ColorFrameReady;
并试图完全理解
WriteableBitmap
功能。根据MSDN(),可写位图的输入 是像素宽度:位图的所需宽度。 像素高度:位图的所需高度。 dpiX:位图的每英寸水平点(dpi)。 dpiY:位图的每英寸垂直点(dpi)。 pixelFormat:位图的System.Windows.Media.pixelFormat。 调色板:位图的System.Windows.Media.Imaging.BitmapPalette

在示例代码中,我了解像素的宽度和高度,但是我不知道dpiX和dpiY是如何生成的。此外,我不理解对
PixelFormats.Bgr32
的调用或分配给调色板参数的
null
变量


我对WriteableBitmaps感兴趣的原因是,我想知道你是否可以保存2个,并将它们相互比较,看看这两个图像有多不同。因此,我试图完全理解他们。谢谢

是每英寸点数,通常用于分辨率。像素格式是用于像素着色的格式(rbg、灰度、argb)。调色板为空,因此它使用默认调色板。知道您可以使用编码器保存可写位图,您可以手动或与其他API(如EmguCV)进行比较。

可写位图可用于写入新字节以更新UI。这使我们能够使用相同的WriteableBitmap并使用相同的内存资源,但只更新内容

在我的文章中,我将解释如何在Kinect场景中使用它