equal
deleted
inserted
replaced
31 |
31 |
32 using Trakers.Tracking; |
32 using Trakers.Tracking; |
33 using System.Threading; |
33 using System.Threading; |
34 using Trakers.Tracking.Events; |
34 using Trakers.Tracking.Events; |
35 using Trakers.Tracking.Gestures; |
35 using Trakers.Tracking.Gestures; |
|
36 using System.Resources; |
|
37 using System.Reflection; |
36 |
38 |
37 namespace Trakers.Debug |
39 namespace Trakers.Debug |
38 { |
40 { |
39 public partial class DebugWindow : Window |
41 public partial class DebugWindow : Window |
40 { |
42 { |
|
43 //Gestionnaire de ressources. |
|
44 private ResourceManager rm; |
41 //Membre permettant d'atteindre la classe KinectMain du sous-module Tracking. |
45 //Membre permettant d'atteindre la classe KinectMain du sous-module Tracking. |
42 private KinectMain kinectMain; |
46 private KinectMain kinectMain; |
43 //Tableau contenant une image en couleurs. |
47 //Tableau contenant une image en couleurs. |
44 private byte[] colorPixelData; |
48 private byte[] colorPixelData; |
45 //Indique si la kinect est allumée/éteinte. |
49 //Indique si la kinect est allumée/éteinte. |
52 * classe KinectMain. |
56 * classe KinectMain. |
53 * Au départ, la kinect est éteinte. |
57 * Au départ, la kinect est éteinte. |
54 */ |
58 */ |
55 public DebugWindow(KinectMain main) |
59 public DebugWindow(KinectMain main) |
56 { |
60 { |
|
61 rm = new ResourceManager("Trakers.Properties.resources", Assembly.GetExecutingAssembly()); |
57 InitializeComponent(); |
62 InitializeComponent(); |
58 kinectMain = main; |
63 kinectMain = main; |
59 on = false; |
64 on = false; |
60 closing = false; |
65 closing = false; |
61 } |
66 } |
142 } |
147 } |
143 } |
148 } |
144 //Si on a des données dans le tableau et que la kinect est allumée. |
149 //Si on a des données dans le tableau et que la kinect est allumée. |
145 if (receivedData && on) |
150 if (receivedData && on) |
146 { |
151 { |
|
152 //Exemples de modifications de l'affichage : |
|
153 //Zombies apocalypse. |
|
154 //Black & White movie. |
147 /*for (int i = 0; i < colorPixelData.Length; i += colorImageFrameData.BytesPerPixel) |
155 /*for (int i = 0; i < colorPixelData.Length; i += colorImageFrameData.BytesPerPixel) |
148 { |
156 { |
149 byte gray = Math.Min(colorPixelData[i], colorPixelData[i + 1]); |
157 byte gray = Math.Min(colorPixelData[i], colorPixelData[i + 1]); |
150 gray = Math.Min(gray, colorPixelData[i + 2]); |
158 gray = Math.Min(gray, colorPixelData[i + 2]); |
151 colorPixelData[i] = gray; |
159 colorPixelData[i] = gray; |
170 */ |
178 */ |
171 public void showDistance(float distance) |
179 public void showDistance(float distance) |
172 { |
180 { |
173 DistanceLbl.Content = "Distance : " + distance; |
181 DistanceLbl.Content = "Distance : " + distance; |
174 |
182 |
175 /*R1.Fill = System.Windows.Media.Brushes.Transparent; |
183 if (distance > 0 && distance < 1) |
176 R2.Fill = System.Windows.Media.Brushes.Transparent; |
|
177 R3.Fill = System.Windows.Media.Brushes.Transparent; |
|
178 R4.Fill = System.Windows.Media.Brushes.Transparent;*/ |
|
179 |
|
180 /*if (distance > 0 && distance < 1) |
|
181 { |
184 { |
182 R1.Fill = System.Windows.Media.Brushes.Red; |
185 R1.Fill = System.Windows.Media.Brushes.Red; |
183 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
186 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
184 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
187 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
185 R4.Fill = System.Windows.Media.Brushes.DarkGray; |
188 R4.Fill = System.Windows.Media.Brushes.DarkGray; |
202 { |
205 { |
203 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
206 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
204 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
207 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
205 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
208 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
206 R4.Fill = System.Windows.Media.Brushes.White; |
209 R4.Fill = System.Windows.Media.Brushes.White; |
207 }*/ |
210 } |
208 } |
211 } |
209 |
212 |
210 /* |
213 /* |
211 * Affiche la détection de la main droite via un label. |
214 * Affiche la détection de la main droite via un label. |
212 */ |
215 */ |
360 LeftHand.Background = System.Windows.Media.Brushes.Black; |
363 LeftHand.Background = System.Windows.Media.Brushes.Black; |
361 RightHand.Background = System.Windows.Media.Brushes.Black; |
364 RightHand.Background = System.Windows.Media.Brushes.Black; |
362 } |
365 } |
363 } |
366 } |
364 } |
367 } |
|
368 |
|
369 /* |
|
370 * Méthode associée à l'événement : Ouvrir la fenêtre de paramétrage via le menu. |
|
371 */ |
|
372 private void Parameters_Click(object sender, RoutedEventArgs e) |
|
373 { |
|
374 DebugParameters param = new DebugParameters(kinectMain); |
|
375 |
|
376 try |
|
377 { |
|
378 param.ShowDialog(); |
|
379 } |
|
380 catch (Exception) |
|
381 { |
|
382 ExceptionLbl.Content = rm.GetString("loadParamFail"); |
|
383 } |
|
384 } |
|
385 |
|
386 /* |
|
387 * Méthode associée à l'événement : Quitter via le menu. |
|
388 */ |
|
389 private void Quit_Click(object sender, RoutedEventArgs e) |
|
390 { |
|
391 closing = true; |
|
392 //On éteint la Kinect (pour éviter qu'elle reste allumée même lorsque le programme est éteint). |
|
393 kinectMain.KinectClose(); |
|
394 Application.Current.Shutdown(); |
|
395 } |
365 } |
396 } |
366 } |
397 } |