Download presentation
Presentation is loading. Please wait.
1
1/64
2
2/64
3
3/64
4
4/64
5
5/64
6
6/64
7
7/64
8
8/64
9
9/64
10
10/64
11
11/64
12
12/64
13
13/64
14
14/64
15
15/64
16
16/64
17
17/64
18
18/64 // 取得一個 Runtime 物件,代表 Kinect 設備 Runtime nui = Runtime.Kinects[0] ; // 初始化設備 nui.Initialize(); // 開始使用 Runtime 物件的方法、事件, // 取得影像、骨架資料、控制攝影機 // 關閉設備 nui.Uninitialize(); // 取得一個 Runtime 物件,代表 Kinect 設備 Runtime nui = Runtime.Kinects[0] ; // 初始化設備 nui.Initialize(); // 開始使用 Runtime 物件的方法、事件, // 取得影像、骨架資料、控制攝影機 // 關閉設備 nui.Uninitialize();
19
19/64 // 取得 Kinect 設備數量 int count = Runtime.Kinects.Count ; MessageBox.Show(" 共有 " + count.ToString() + " 台 Kinect 設備 "); // 取得一個 Runtime 物件, index 代表 Kinect 設備的編號 nui = Runtime.Kinects[0]; // 取得 Kinect 設備數量 int count = Runtime.Kinects.Count ; MessageBox.Show(" 共有 " + count.ToString() + " 台 Kinect 設備 "); // 取得一個 Runtime 物件, index 代表 Kinect 設備的編號 nui = Runtime.Kinects[0];
20
20/64
21
21/64
22
22/64
23
23/64
24
24/64
25
25/64
26
26/64
27
27/64
28
28/64 Runtime nui = Runtime.Kinects[0]; nui.Initialize(RuntimeOptions.UseColor | RuntimeOptions.UseDepth); nui.VideoFrameReady += new EventHandler ( nui_VideoFrameReady); nui.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color); nui.DepthFrameReady += new EventHandler ( nui_DepthFrameReady); nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution640x480, ImageType.Depth); Runtime nui = Runtime.Kinects[0]; nui.Initialize(RuntimeOptions.UseColor | RuntimeOptions.UseDepth); nui.VideoFrameReady += new EventHandler ( nui_VideoFrameReady); nui.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color); nui.DepthFrameReady += new EventHandler ( nui_DepthFrameReady); nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution640x480, ImageType.Depth);
29
29/64 void nui_VideoFrameReady(object sender, ImageFrameReadyEventArgs e) { PlanarImage data = e.ImageFrame.Image; image1.Source = BitmapSource.Create(data.Width, data.Height, 96, 96, PixelFormats.Bgr32, null, data.Bits, data.Width * data.BytesPerPixel); } void nui_DepthFrameReady(object sender, ImageFrameReadyEventArgs e) { // 使用 Coding4Fun 函式庫 image2.Source = e.ImageFrame.ToBitmapSource(); } void nui_VideoFrameReady(object sender, ImageFrameReadyEventArgs e) { PlanarImage data = e.ImageFrame.Image; image1.Source = BitmapSource.Create(data.Width, data.Height, 96, 96, PixelFormats.Bgr32, null, data.Bits, data.Width * data.BytesPerPixel); } void nui_DepthFrameReady(object sender, ImageFrameReadyEventArgs e) { // 使用 Coding4Fun 函式庫 image2.Source = e.ImageFrame.ToBitmapSource(); }
30
30/64 // 建立一個 Runtime 物件,代表 Kinect 設備 nui = Runtime.Kinects[0]; // 初始化設備 nui.Initialize(); // 角度範圍 : +28 ~ -28 nui.NuiCamera. ElevationAngle = 20; // 建立一個 Runtime 物件,代表 Kinect 設備 nui = Runtime.Kinects[0]; // 初始化設備 nui.Initialize(); // 角度範圍 : +28 ~ -28 nui.NuiCamera. ElevationAngle = 20;
31
31/64 Demo
32
32/64
33
33/64
34
34/64
35
35/64
36
36/64
37
37/64 1514131211109876543210 深度資料 (mm) 玩家編號 (0-7)
38
38/64 Demo
39
39/64
40
40/64 // 初始化 KinectAudioSource using (var source = new KinectAudioSource()) { source.SystemMode = SystemMode.OptibeamArrayOnly; // 註冊聲音方向改變事件 source.BeamChanged += source_BeamChanged; // 開始錄製 using (var audioStream = source.Start()) { int count; while ((count = audioStream.Read(buffer, 0, buffer.Length)) > 0) { // 如果聲音很清楚,印出聲音來源位置 if(source.SoundSourcePositionConfidence>0.9) Console.Write(" 聲音來源位置 : {0} 度 \t\t 聲音方向 : {1} 度 \r", source.SoundSourcePosition * 180 / Math.PI, source.MicArrayBeamAngle * 180 / Math.PI); } // 初始化 KinectAudioSource using (var source = new KinectAudioSource()) { source.SystemMode = SystemMode.OptibeamArrayOnly; // 註冊聲音方向改變事件 source.BeamChanged += source_BeamChanged; // 開始錄製 using (var audioStream = source.Start()) { int count; while ((count = audioStream.Read(buffer, 0, buffer.Length)) > 0) { // 如果聲音很清楚,印出聲音來源位置 if(source.SoundSourcePositionConfidence>0.9) Console.Write(" 聲音來源位置 : {0} 度 \t\t 聲音方向 : {1} 度 \r", source.SoundSourcePosition * 180 / Math.PI, source.MicArrayBeamAngle * 180 / Math.PI); }
41
41/64 Demo
42
42/64
43
43/64
44
44/64
45
45/64
46
46/64
47
47/64 Runtime nui = Runtime.Kinects[0]; nui.Initialize(RuntimeOptions.UseSkeletalTracking); nui.SkeletonFrameReady += new EventHandler ( nui_SkeletonFrameReady ); Runtime nui = Runtime.Kinects[0]; nui.Initialize(RuntimeOptions.UseSkeletalTracking); nui.SkeletonFrameReady += new EventHandler ( nui_SkeletonFrameReady );
48
48/64
49
49/64 void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) { // 迴圈有可能跑多次 ( 多個玩家被追蹤 ) foreach(SkeletonData data in e.SkeletonFrame.Skeletons) { // 只要處理正在被追蹤的玩家 if (data.TrackingState == SkeletonTrackingState.Tracked) { JointCollection jc = data.Joints; Vector v = jc[JointID.Head].Position; // 處理關節座標 v } void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) { // 迴圈有可能跑多次 ( 多個玩家被追蹤 ) foreach(SkeletonData data in e.SkeletonFrame.Skeletons) { // 只要處理正在被追蹤的玩家 if (data.TrackingState == SkeletonTrackingState.Tracked) { JointCollection jc = data.Joints; Vector v = jc[JointID.Head].Position; // 處理關節座標 v }
50
50/64
51
51/64
52
52/64 Demo
53
53/64
54
54/64
55
55/64 private void NuiSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) { var result = from s in e.SkeletonFrame.Skeletons where s.TrackingState == SkeletonTrackingState.Tracked select s; skeleton.SkeletonData = result.FirstOrDefault(); } private void NuiSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) { var result = from s in e.SkeletonFrame.Skeletons where s.TrackingState == SkeletonTrackingState.Tracked select s; skeleton.SkeletonData = result.FirstOrDefault(); }
56
56/64
57
57/64 Demo
58
58/64
59
59/64
60
60/64
61
61/64
62
62/64
63
63/64 Q & A
64
64/64 ©2009 Microsoft, Microsoft Dynamics, the Office logo, and Your potential. Our passion. are trademarks of the Microsoft group of companies. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.