保存kinect深度数据

问题描述

usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;usingSystem.Windows.Documents;usingSystem.Windows.Input;usingSystem.Windows.Media;usingSystem.Windows.Media.Imaging;usingSystem.Windows.Navigation;usingSystem.Windows.Shapes;usingMicrosoft.Kinect;usingSystem.Diagnostics;usingSystem.IO;namespaceDepthTextStream{///<summary>///InteractionlogicforMainWindow.xaml///</summary>publicpartialclassMainWindow:Window{publicMainWindow(){InitializeComponent();}constfloatMaxDepthDistance=4095;//maxvaluereturnedconstfloatMinDepthDistance=850;//minvaluereturnedconstfloatMaxDepthDistanceOffset=MaxDepthDistance-MinDepthDistance;privatevoidWindow_Loaded(objectsender,RoutedEventArgse){kinectSensorChooser1.KinectSensorChanged+=newDependencyPropertyChangedEventHandler(kinectSensorChooser1_KinectSensorChanged);}voidkinectSensorChooser1_KinectSensorChanged(objectsender,DependencyPropertyChangedEventArgse){varoldSensor=(KinectSensor)e.OldValue;//stoptheoldsensorif(oldSensor!=null){oldSensor.Stop();oldSensor.AudioSource.Stop();}//getthenewsensorvarnewSensor=(KinectSensor)e.NewValue;if(newSensor==null){return;}//turnonfeaturesthatyouneednewSensor.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30);newSensor.SkeletonStream.Enable();//signupforeventsifyouwanttogetatAPIdirectlynewSensor.AllFramesReady+=newEventHandler(newSensor_AllFramesReady);try{newSensor.Start();}catch(System.IO.IOException){//thishappensifanotherappisusingtheKinectkinectSensorChooser1.AppConflictOccurred();}}voidnewSensor_AllFramesReady(objectsender,AllFramesReadyEventArgse){short[]depthData;using(DepthImageFramedepthFrame=e.OpenDepthImageFrame())//createanewframeeverytimeoneisready{//assignavaluetodepthDatadepthData=newshort[depthFrame.PixelDataLength];}}privatevoidSaveDepthData(short[]depthData){//initializeaStreamWriterStreamWritersw=newStreamWriter(@"C:/Example.txt");//searchthedepthdataandaddittothefilefor(inti=0;i<depthData.Length;i++){sw.WriteLine(depthData[i]+"n");//nforanewline}//disposeofswsw.Close();SaveDepthData(depthData);}privatevoidWindow_Closing(objectsender,System.ComponentModel.CancelEventArgse){StopKinect(kinectSensorChooser1.Kinect);}privatevoidStopKinect(KinectSensorsensor){if(sensor!=null){if(sensor.IsRunning){//stopsensorsensor.Stop();//stopaudioifnotnullif(sensor.AudioSource!=null){sensor.AudioSource.Stop();}}}}}}

解决方案

时间: 2024-08-01 05:53:41

保存kinect深度数据的相关文章

openni-关于使用opencv读取kinect深度信息和彩色图像并显示

问题描述 关于使用opencv读取kinect深度信息和彩色图像并显示 VideoCapture capture(CV_CAP_OPENNI) 使用这个的前提是不是必须要安装OPENNI啊? 解决方案 不需要,直接获取数据岛OpenCV中进行运算.

win8系统下保存历史文件数据的方法

  小编就来教大家win8电脑中如何使用文件历史数据进行保存文件. win8系统下保存历史文件数据的方法教程 1.打开电脑之后,咱们直接按下快捷键win+i,这样就会弹出一个设置界面,咱们直接选择设置中的控制面板功能. 2.在控制面板的界面中,咱们找到并选中系统和安全下的"通过文件历史记录保存你的文件备份副本"选项. 3.接下来需要咱们选择一个盘或者是移动设备来存储这些东西,这里需要说明的是,由于文件可能很大,所以小编建议大家选择8G及以上的存储盘来保存文件.选择好之后,点击页面中的启

coin3d 读取场景深度数据

问题描述 coin3d 读取场景深度数据 用coin3D 的SoOffScreenRenderer类的对象渲染场景后,再用opengl函数glReadPixels来读取深度数据,但是根本没有作用,但是同样的代码在open Inventor里是可以的,就想问有没有人碰到过类似的问题,下面就是一个例子的代码:int _tmain(int char **argv){ HWND window = SoWin::init(argv[0]); if (window==NULL) exit(1); int w

kinect深度图像深度图像增强代码

问题描述 kinect深度图像深度图像增强代码 最近一直在忙毕业设计,关于kinect深度图像增强的,只是编程能力太差,弄了好久都没弄出来,只能在此求助各位大神 解决方案 需求不明确,描述清楚些

深度数据包检测DPI开发解析

深度数据包检测(Deep packet inspection,缩写为 DPI)是一种特殊的网络技术,一般网络设备只会查看以太网头部.IP头部而不会分析TCP/UDP里面的内容这种被称为浅数据包检测;与之对应的DPI会检查TCP/UDP里面的内容,所以称为深度数据包检测. DPI一般是一个硬件或者软件,一般用"旁挂"的方式接入到网络.它会对网络中的每个数据包进行检查,识别出应用层协议,根据识别的协议采取一定的措施(比如记录HTTP访问行为).对于TCP协议它可以识别完整的TCP交互过程(

数据不更新-对GridView的一列数据进行修改,点击保存后,数据并没有更新

问题描述 对GridView的一列数据进行修改,点击保存后,数据并没有更新 protected void Button1_Click(object sender, EventArgs e) { for (int i = 0; i < GridView1.Rows.Count; i++) { GridViewRow row = GridView1.Rows[i]; string connString = "Data Source=ilovefamily\mysql;Initial Catal

怎么获取kinect深度值

问题描述 怎么获取kinect深度值 个人使用1.7,目前已得到png格式图片,怎么获得其深度值,求各位大神指点迷津.最好可以给出完整程序 解决方案 Kinect原理深度剖析 解决方案二: 这不是直接用api不就行了,openini

安卓java-怎么只写一个SharedPreferences让它保存多个数据,而不用像下面代码一样写多个SharedPreferences来保存数据

问题描述 怎么只写一个SharedPreferences让它保存多个数据,而不用像下面代码一样写多个SharedPreferences来保存数据 package com.myedit; import android.app.*; import android.os.*; import android.view.*; import android.widget.*; import android.view.View.*; import android.content.*; public class

kinect-关于一篇Kinect深度增强的文章

问题描述 关于一篇Kinect深度增强的文章 文章名为:Depth map enhancement based on color and depth consistency 想实现里面的内容,可是好多东西不懂!也没时间做,有没有大神愿意花点时间赚点外快的联系我 解决方案 楼主都不懂这让程序员如何实现?看文献查资料么,这太不显示. 建议你把需求搞清楚,看了你说的这篇文献,需要图像处理方面的技术人员吧.