如何使用位图可写的Kinect在2013 VS WPF应用程序中保存的视频资料? [英] How are writeable bitmaps used with the kinect in VS 2013 wpf applications to hold video information?

查看:174
本文介绍了如何使用位图可写的Kinect在2013 VS WPF应用程序中保存的视频资料?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看的颜色基本样品从Kinect的开发人员工具包使用系统

I'm looking at the colors basic sample from the Kinect developers toolkit

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(的 http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.writeablebitmap%28v=vs.110%29.aspx )为一个WriteableBitmap的
中的输入是pixelWidth:位图的期望的宽度。
pixelHeight:位图的期望的高度。
dpiX:位图的水平的点每英寸(dpi)。
dpiY:位图的垂直点每英寸(dpi)。
的PixelFormat:位图的System.Windows.Media.PixelFormat。
调色板:位图的System.Windows.Media.Imaging.BitmapPalette。

and trying to fully understand the WriteableBitmap feature. According to MSDN (http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.writeablebitmap%28v=vs.110%29.aspx) the inputs for a WriteableBitmap are pixelWidth: The desired width of the bitmap. pixelHeight:The desired height of the bitmap. dpiX: The horizontal dots per inch (dpi) of the bitmap. dpiY: The vertical dots per inch (dpi) of the bitmap. pixelFormat: The System.Windows.Media.PixelFormat of the bitmap. palette: The System.Windows.Media.Imaging.BitmapPalette of the bitmap.

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

In the sample code I understand pixel width and height, however I don't know how dpiX and dpiY were generated. Additionally I don't understand the call to PixelFormats.Bgr32 or the null variable assigned to the palette parameter.

原因我在WriteableBitmaps兴趣的是,我不知道是否可以保存2和它们的相互比较,看两张图片是多么的不同。因此,我想完全了解他们。谢谢!

The reason for my interest in WriteableBitmaps is that I'm wondering if you can save 2 and compare them to each other to see how different two images are. Therefore, I'm trying to fully understand them. Thanks!

推荐答案

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

A WriteableBitmap can be used to write new bytes in order to update the UI. This enables us to use the same WriteableBitmap and use the same resources in memory but only update the content.

在我的教程我解释你怎么能在Kinect的情况下使用它!

In my tutorial I explain how you can use it in a Kinect scenario!

这篇关于如何使用位图可写的Kinect在2013 VS WPF应用程序中保存的视频资料?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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