29 |
29 |
30 using Coding4Fun.Kinect.Wpf; |
30 using Coding4Fun.Kinect.Wpf; |
31 |
31 |
32 using Trakers.Tracking; |
32 using Trakers.Tracking; |
33 using System.Threading; |
33 using System.Threading; |
|
34 using Trakers.Tracking.Events; |
|
35 using Trakers.Tracking.Gestures; |
34 |
36 |
35 namespace Trakers.Debug |
37 namespace Trakers.Debug |
36 { |
38 { |
37 public partial class DebugWindow : Window |
39 public partial class DebugWindow : Window |
38 { |
40 { |
140 } |
142 } |
141 } |
143 } |
142 //Si on a des données dans le tableau et que la kinect est allumée. |
144 //Si on a des données dans le tableau et que la kinect est allumée. |
143 if (receivedData && on) |
145 if (receivedData && on) |
144 { |
146 { |
|
147 /*for (int i = 0; i < colorPixelData.Length; i += colorImageFrameData.BytesPerPixel) |
|
148 { |
|
149 byte gray = Math.Min(colorPixelData[i], colorPixelData[i + 1]); |
|
150 gray = Math.Min(gray, colorPixelData[i + 2]); |
|
151 colorPixelData[i] = gray; |
|
152 colorPixelData[i + 1] = gray; |
|
153 |
|
154 colorPixelData[i] = colorPixelData[i + 1]; |
|
155 colorPixelData[i + 1] = colorPixelData[i]; |
|
156 colorPixelData[i + 2] = (byte)~colorPixelData[i + 2]; |
|
157 }*/ |
|
158 |
145 //On met à jour l'image de la caméra. |
159 //On met à jour l'image de la caméra. |
146 DebugImage.Source = BitmapSource.Create(colorImageFrameData.Width, colorImageFrameData.Height, 96, 96, PixelFormats.Bgr32, null, colorPixelData, colorImageFrameData.Width * colorImageFrameData.BytesPerPixel); |
160 DebugImage.Source = BitmapSource.Create(colorImageFrameData.Width, colorImageFrameData.Height, 96, 96, PixelFormats.Bgr32, null, colorPixelData, colorImageFrameData.Width * colorImageFrameData.BytesPerPixel); |
147 DebugImage.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; |
161 DebugImage.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; |
148 DebugImage.VerticalAlignment = System.Windows.VerticalAlignment.Center; |
162 DebugImage.VerticalAlignment = System.Windows.VerticalAlignment.Center; |
149 DebugImage.Stretch = Stretch.Fill; |
163 DebugImage.Stretch = Stretch.Fill; |
156 */ |
170 */ |
157 public void showDistance(float distance) |
171 public void showDistance(float distance) |
158 { |
172 { |
159 DistanceLbl.Content = "Distance : " + distance; |
173 DistanceLbl.Content = "Distance : " + distance; |
160 |
174 |
161 if (distance > 0 && distance < 1) |
175 /*R1.Fill = System.Windows.Media.Brushes.Transparent; |
|
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) |
162 { |
181 { |
163 R1.Fill = System.Windows.Media.Brushes.Red; |
182 R1.Fill = System.Windows.Media.Brushes.Red; |
164 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
183 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
165 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
184 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
166 R4.Fill = System.Windows.Media.Brushes.DarkGray; |
185 R4.Fill = System.Windows.Media.Brushes.DarkGray; |
183 { |
202 { |
184 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
203 R1.Fill = System.Windows.Media.Brushes.DarkGray; |
185 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
204 R2.Fill = System.Windows.Media.Brushes.DarkGray; |
186 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
205 R3.Fill = System.Windows.Media.Brushes.DarkGray; |
187 R4.Fill = System.Windows.Media.Brushes.White; |
206 R4.Fill = System.Windows.Media.Brushes.White; |
188 } |
207 }*/ |
189 } |
208 } |
190 |
209 |
191 /* |
210 /* |
192 * Affiche la détection de la main droite via un label. |
211 * Affiche la détection de la main droite via un label. |
193 */ |
212 */ |
260 line.X2 = j2.Position.X; |
279 line.X2 = j2.Position.X; |
261 line.Y1 = j1.Position.Y; |
280 line.Y1 = j1.Position.Y; |
262 line.Y2 = j2.Position.Y; |
281 line.Y2 = j2.Position.Y; |
263 line.StrokeThickness = 8; |
282 line.StrokeThickness = 8; |
264 DebugCanvas.Children.Add(line); |
283 DebugCanvas.Children.Add(line); |
|
284 ExceptionLbl.Content = DebugCanvas.Children.Count; |
265 } |
285 } |
266 |
286 |
267 /* |
287 /* |
268 * Dessine le squelette (ensemble des os), en ayant en paramètres tous les noeuds. |
288 * Dessine le squelette (ensemble des os), en ayant en paramètres tous les noeuds. |
269 */ |
289 */ |
305 public void showRightHandCoord(String coord) |
325 public void showRightHandCoord(String coord) |
306 { |
326 { |
307 RightHand.Content = coord; |
327 RightHand.Content = coord; |
308 } |
328 } |
309 |
329 |
310 public void showSwipe() |
330 public void showSwipe(SwipeEventArgs e) |
311 { |
331 { |
312 ExceptionLbl.Background = System.Windows.Media.Brushes.Red; |
332 if(e.direction == Tracking.Gestures.SwipeDetector.Direction.LEFT) |
|
333 ExceptionLbl.Background = System.Windows.Media.Brushes.Red; |
|
334 else if(e.direction == Tracking.Gestures.SwipeDetector.Direction.RIGHT) |
|
335 ExceptionLbl.Background = System.Windows.Media.Brushes.Purple; |
|
336 } |
|
337 |
|
338 public void showPush(PushEventArgs e) |
|
339 { |
|
340 if (e.direction == Tracking.Gestures.PushDetector.Direction.PUSH) |
|
341 { |
|
342 if(e.hand == Tracking.Gestures.PushDetector.Hand.LEFT) |
|
343 LeftHand.Background = System.Windows.Media.Brushes.White; |
|
344 else if(e.hand == Tracking.Gestures.PushDetector.Hand.RIGHT) |
|
345 RightHand.Background = System.Windows.Media.Brushes.White; |
|
346 else |
|
347 { |
|
348 LeftHand.Background = System.Windows.Media.Brushes.White; |
|
349 RightHand.Background = System.Windows.Media.Brushes.White; |
|
350 } |
|
351 } |
|
352 else |
|
353 { |
|
354 if (e.hand == Tracking.Gestures.PushDetector.Hand.LEFT) |
|
355 LeftHand.Background = System.Windows.Media.Brushes.Black; |
|
356 else if (e.hand == Tracking.Gestures.PushDetector.Hand.RIGHT) |
|
357 RightHand.Background = System.Windows.Media.Brushes.Black; |
|
358 else |
|
359 { |
|
360 LeftHand.Background = System.Windows.Media.Brushes.Black; |
|
361 RightHand.Background = System.Windows.Media.Brushes.Black; |
|
362 } |
|
363 } |
313 } |
364 } |
314 } |
365 } |
315 } |
366 } |